I have a rule made by myself. I call it "550 line".
If a class have more than 500 or a method more than 50 line, something is wrong.
(Is there any better rule? Tell if there is some)

  • 2
    📌📌📌 would surely like to know about this.

    if i have to follow your naming convention , then i have similar rule for myself and it would be called
    220 rule
  • 6
    220 is good but sometimes it's impossible.
    550 is at most. 220; is best.
  • 4
    50 lines for a single method is insane..

    You should probably be able to split it out into smaller pieces for readability, and possible code reuse reasons.
  • 2
    @fattymiller I think you didn't get it.
    550 is not a standard or average.
    It's at most. Method shouldn't have more than 50 line. It's not meant, it is good to be 50. I think 220 is rule for good programming.
    I mean:
    1- class under 200 is good class and method under 20 is a good method.
    2- class over 500 is bad class and method over 50 is bad method.
    Then between these numbers is not good and not bad area.
  • 0
    @demiDev no, I got it. I was just surprised that your upper bound is that high.

    I was thinking 15 was already getting up there..
  • 2
    Rule is for everyone and have to be somehow any one be able to follow it. So let's spread this rule for everyone.
  • 0
    I use the 10 10 10 rule.
    Max 10 lines of code per function or method
    Max 10 public functions in a module or 10 methods in an interface
    Max 10 modules or classes in the same folder
Your Job Suck?
Get a Better Job
Add Comment