Principles
Extract Method: Breaking Up Long Functions
Extract Method moves a block of a long function into its own function with a name that says what it does, until the original reads like a list of steps. Long methods hide where each job starts and ends, so changes land in the wrong place. These lessons split a grocery checkout into named steps, one extraction at a time.
Pick your language
When to use it
Use it when
You have to read a whole method to find the part you need to change.
Skip it when
The lines already say what they do, and a method named after them would only repeat them.
Spot it by
Long methods, comments that label each section, and one variable that means different things as it goes.