CleanCode icon indicating copy to clipboard operation
CleanCode copied to clipboard

Maximum methods per class

Open sbradl opened this issue 5 years ago • 2 comments

I think this should only take public and maybe protected methods into account. At the moment it counts private methods too.

Nice work btw .)

sbradl avatar May 20 '20 06:05 sbradl

I think that is a tricky question, because would you consider a class with 2-3 public methods and 10-100 private methods clean? I don't think that a class should be divided by access identifier, because the overall size of the class increases and so would the responsibility.

MO2k4 avatar May 27 '20 10:05 MO2k4

Yeah indeed it is tricky. Without any actual numbers I would rather tolerate 20 private methods but not 20 public ones. But 1 public method with 20 private ones seems off too.

Maybe these are two separate concerns. One is the view from the outside - the amount of public methods and the other one is the actual code size

sbradl avatar May 27 '20 10:05 sbradl