No, no, no, no. Did I mention no? I inherited a Javascript application that was maybe 1500 lines of code. Every function was 3-5 lines. Most were like this:
And foo.some_method (in another file) was similar. What it meant was it was impossible to get a view of what was going on in the system. It took months to accomplish an understanding that should have taken weeks.
I really think the original authors heard your advice and decided comprehension didn't matter, only function length.
Function should accomplish a task. Sometimes (very rarely) a task may be two hundred lines; usually, it is much shorter. Sometimes three lines, but often 15-20.
I really think the original authors heard your advice and decided comprehension didn't matter, only function length.
Function should accomplish a task. Sometimes (very rarely) a task may be two hundred lines; usually, it is much shorter. Sometimes three lines, but often 15-20.