4 ms·
Yeah I never got that whole "a function can never be longer than X lines". Screw that. Put everything that's relevant in that context in the function and only s
by dstick 4y ago
Yeah I never got that whole "a function can never be longer than X lines". Screw that. Put everything that's relevant in that context in the function and only start breaking things up once it has to be re-used. Which happens a lot less often than many books and guides make out to be.
- toto444 4y agoI once read a comment or post on HN that was saying something around the line : 'good code is code that you can throw away easily'. A long function that can be broken down easily meets that criterion.
- Akronymus 4y agoAlso, internal functions/lambdas first before exposing it externally makes the most sense in many cases. Reduces namespace pollution and makes it easier to rewrite those inner ones.