Deep Simplicity - Rule 6

The next rule in Deep Simplicity is Keep All Entities Small. This is one of the rules that I think should be more of a guideline. Jeff Bay thinks that a class should be no more than fifty lines. I think adding the corollary that it's fifty lines without comments makes this rule a little more palatable.

That being said, Jeff does have some good reasons for limiting the class size. The first reason is that classes that are more than fifty lines long tend to do more than one thing - which is bad because it makes them harder to understand and harder to reuse. Another good point is that a class that is small is going to fit onto your screen without scrolling, being able to see as much of it as possible means that it is easier to grasp all of the responsibilities of the class.

That's it for this one, next time we'll talk about rule #7: Don't Use Any Classes with More Than Two Instance Variables

blogroll

social