Skip to main content
Post Made Community Wiki by CodeART
Source Link
Bob Murphy
  • 16.1k
  • 3
  • 53
  • 78

I find it easier to keep track of what I'm doing if I can see the entire function all at once. So here's how I prefer to write functions:

  1. Short enough to fit on my monitor with a reasonable font.
  2. If it needs to be longer than #1, short enough to print on a piece of paper in a reasonable font.
  3. If it needs to be longer than #2, short enough to print 2-up on a piece of paper.

I rarely write functions longer than that. Most of those are giant C/C++ switch statements.