Freigeben über


Object Calisthenics: Rule 6: Keep all entities small

This is a funny rule when exercising this. No class should be more than 50 lines long and no package should have more than 10 files. I guess package is a java-ism and converting to .Net I's say no more than 10 classes in each name-space. This is the rule that really makes you find the smallest responsibilities of your classes. A class that may have looked clean and with only one responsibility actually does more than one thing.

This is one of those rules you really should remember is only intended for practicing object calisthenics and not intended for "real code". At least with the hard limits of 50 lines per class. But I think the essence of this rule makes much sense in all OO design. Smaller classes are easier to grasp and more likely to have only one responsibility.