3 ms·
Splitting 100-lines-long function into let's optimistically say ten 5-lines-long functions is only a win in readibility if you strongly restrict the number of w
by ajuc 6y ago
Splitting 100-lines-long function into let's optimistically say ten 5-lines-long functions is only a win in readibility if you strongly restrict the number of ways in which these 10 new functions can be combined (by scopes, typing, good naming conventions, etc.).
If you just extract the functions and change nothing else - you have 50 lines of code to read instead of 100 but you have 10! possible permutations of these function calls instead of 1 to think about.
- christophilus 6y agoAnd you have 10 new, probably misleading names to think about. Naming is one of the hard problems, and a preference for small functions means you run into this problem more frequently.