Keep classes small as complexity grows. A class with too many methods becomes harder to understand, maintain, refactor, test, and evolve. section 1.2.1
Control class growth by:
- Moving new complexity into a separate location instead of continually extending an existing class. section 2.3
- Giving complex business logic its own cohesive class when the rule spans multiple classes or requires many dependencies. section 2.3.1
- Keeping business logic close to the class it acts on; for example, let Enrollment mark itself canceled. section 2.3.1
- Making the class that contains data enforce its consistency rather than requiring callers to coordinate related updates. section 3.1.1
Isolating complexity and consistency
Instead of adding a complex feature to an already growing class, place that feature in a dedicated class with explicit dependencies. Separately, let Offering reject enrollment beyond its participant limit and reduce available seats when enrollment succeeds. section 2.3.1 section 3.1.1
A practical design question
Ask whether you prefer many small classes or one larger class, and define what maximum method size would be reasonable. Use the answer to examine maintainability rather than enforce an unexplained absolute rule. section 2.4
Use the figure to trace how initially simple classes and methods become difficult to maintain as complexity accumulates. section 1.2.1
Use the figure to see an entity class enforcing its own consistency. section 3.1.1




















