1000.md
November 17, 2019 ยท View on GitHub
A class or interface should have a single purpose within the system it functions in. In general, a class either represents a primitive type like an email or ISBN number, an abstraction of some business concept, a plain data structure, or is responsible for orchestrating the interaction between other classes. It is never a combination of those. This rule is widely known as the Single Responsibility Principle, one of the S.O.L.I.D. principles.
Tip: A class with the word And in it is an obvious violation of this rule.
Tip: Use Design Patterns to communicate the intent of a class. If you can't assign a single design pattern to a class, chances are that it is doing more than one thing.
Note If you create a class representing a primitive type you can greatly simplify its use by making it immutable.