Re:A thread for Junior Developers/Engineers
by zawazzi on Thursday January 03, 2019 @03:25PM
(#18818959)
I think all humans are bounded by 7+/-2 chunks of working memory which I think correlates to upper bound of understandability. Personally I break up methods where I see more than 5-7 unique params/variables/concepts. Also usually co-locating related methods will help which is what OOP does.
For me it actually makes code less readable. It makes the system more complex (because you've added extra function definitions and function calls) and just jumping back-and-forth between those small function calls makes code harder to read. I would much prefer to have a larger method that just does things in order, and, for readability, have its body divided into sections, each in isolated brackets (so that variables have local scope) and commented if necessary.