Skip to main content
CODING-FUNDAMENTALS5 MIN READ

Small Functions Need a Promise

Write functions around a clear promise instead of a loose sequence of steps.

A function is not a drawer for lines of code. It is a promise. Refactoring is behavior-preserving design work. When you extract a function, you are saying the extracted block has a stable purpose worth naming. The name should let a reader predict what the function does, what it returns, and what kind of change belongs inside it. One Reason to Change Validation changes when business rules change. Formatting changes when display standards change. Network calls change when integration contracts change. If all three live together, unrelated changes collide. Inputs and Outputs Should Be Boring A small function is easiest…

Read the full lesson

Sign up free — one personalized lesson every day, matched to your role and goals.

Already have an account? Sign in

← Back to library
Contact us