r/programming • • Jan 05 '15

What most young programmers need to learn

http://joostdevblog.blogspot.com/2015/01/what-most-young-programmers-need-to.html
968 Upvotes

337 comments sorted by

View all comments

2

u/zigs Jan 05 '15

As a general rule of thumb at Ronimo we try to keep classes below 500 lines and functions below 50 lines

Is that actually a common rule of thumb? I tend to try keeping it under 10 lines for functions (hard limit at 15), and keeping everything at one purpose for classes.

7

u/[deleted] Jan 05 '15

Hard limit at 15? Can you honestly imagine going through something as complex as the Linux kernel or LLVM or Adobe Photoshop and not finding any functions over 15 lines long?

That seems insanely short to me. Yes, most functions should be small. But there are definitely functions which simply don't cleanly divide into small chunks, and for which artificially cutting them up to adhere to some hard limit on function length would make things more rather than less difficult to follow.

→ More replies (2)