|
|
|
|
|
by flatline3
5051 days ago
|
|
Given the mental and work effort necessary to hoist out a function versus writing a simple comment, I think your position involves untenable trade-offs. I'd much rather see code commenting the major steps of the function than a file riddled with tiny functions, all of which require breaking my train of thought, switching to a different section of the file to read, and then going back to the original function. That's ludicrous compared to a one-liner "Send our token to the server" comment on a small block of code. |
|
Functions shouldn't have major steps, they should be one step each with a top level function calling the steps in sequence. A function should do one conceptual thing, or be a delegator to sequence other functions.
Mixing levels of abstraction where all the steps are inlined into the larger master function that also sequences them is IMHO a code smell that demands fixing. Kent Beck had quite a bit to say about this very thing in Smalltalk Best Practice Patterns.
Like I said, I bet you use the scroll bar a lot.