Skip to main content
2 of 6
added 215 characters in body
haylem
  • 29k
  • 11
  • 107
  • 119

Depends on the language you use, but in general (and for my personal taste):

  • Ideally, less than 25 lines.
  • Acceptably, less than 35 lines.

If it's more, then it's something I need to come back to later and rework.

But realistically, any size it needs to be when you need to deliver something and that it makes more sense on the moment to spit them out like that, makes it even easier sometimes for someone to review before shipping. (but still get back to it later).

(Recently my team ran a program on our codebase: we found class with 197 methods and another with only 3 methods but one of them was 600 lines. Cute game: what's the worse of the 2 evil?)


Now for a more zen answer... In general it's considered a good practice (TM) to quote a great man, so here goes:

Everything should be made as simple as possible, but not simpler. - A. Einstein

haylem
  • 29k
  • 11
  • 107
  • 119