2 ms·
> A short, atomic unit of 4-6 lines of code does not deserve to be a function simply because it's an atomic unit And I couldn't disagree more with that stateme
by gnaritas 14y ago
> A short, atomic unit of 4-6 lines of code does not deserve to be a function simply because it's an atomic unit
And I couldn't disagree more with that statement, and virtually everything you've said. Maintainers don't need to look at a function to see what it does, that's what its name tells you and keeping functions focused on doing one atomic thing is what allows the name to replace the implementation and makes for well written programs. I despise programs written in the style you suggest.
A well written program is a thousand small functions/methods unburdened by long methods full of comments. Good code requires few comments other than those that explain implementation choices or class responsibilities. Comments are a code smell most of the time, they exist to make up for poorly written code.
- dllthomas 14y agoI mostly agree, but "they exist to make up for poorly written code" should be "they exist to make up for less maintainable code." Less maintainable code may not be poorly written if other constraints (intense optimization in a critical path, for instance) force it on you.
- gnaritas 14y agoWell, I did say to explain implementation choices which I think covers your point, as I do agree with you.