2 ms·
> they can read it from beginning to end and it makes sense. I disagree. First 20 lines in a single block means that any single line can have interact with any
by dcolkitt 7y ago
> they can read it from beginning to end and it makes sense.
I disagree. First 20 lines in a single block means that any single line can have interact with any other. The 19th line's behavior can be subtly influenced by what's on the first line. That means it's not just an issue of reading line-by-line. You have to keep every line in the entire code block in working memory simultaneously.
The limits of human working memory is about seven or eight chunks. When functions get longer than this, they take exponentially longer to understand. 100 lines of code broken up into 25 line functions can take ten times longer to understand than 1000 lines of code broken up into well-abstracted four line functions.