Split large classes

From CSSEMediaWiki
Jump to: navigation, search

A large class generally represents a poor design. A class should represent an abstraction, and the larger the class the more complicated the abstraction. It is likely that any class containing 50 methods is representing several abstractions and should be split up into the separate abstractions. Johnson and Foote 1988 states that "Large classes should be viewed with suspicion and held to be guilty of poor design until proven innocent".

The main motivation behind this rule is that large classes are much harder to reuse than a collection of small classes.

See Also

Personal tools