2 ms·
I just don't understand how 100 lines comprising 10 or 20 functions in the same file (as in the cited example) is any different than 100 lines of a single funct
by notreallyserio 5y ago
I just don't understand how 100 lines comprising 10 or 20 functions in the same file (as in the cited example) is any different than 100 lines of a single function that does the same thing. Is it just that the former has one fewer tab per line?
This is the sort of advice that can quickly become a thought terminator because the writer has so much authority.
- ajuc 5y agoThe difference is that 1 big functions naturally encodes the ordering and dependencies between things that happen inside - because it's linear and has nested braces. 10 or 20 small functions with no nesting inside still has all the complexity, but none of the structure to help programmer understand it. Functions can be called in any order, any number of times, and you have to trace the full call-stack in your mind and keep it there to get the same understanding of what happens that you had just by looking at the linear code.
- deleted 5y ago[deleted]