In the course of the discussion on design patterns, I have stated a number of the principles of the object-oriented paradigm. These principles can be summarized as follows:
Objects are things with well-defined responsibilities.
Objects are responsible for themselves.
Encapsulation means any kind of hiding
- Data-hiding
- Class hiding (behind an abstract class or interface)
- Implementation hiding
Abstract out variations in behavior and data with commonality/variability analysis.
Design to interfaces.
Think of inheritance as a method of conceptualizing variation, not for making special cases of existing objects.
Keep variations in a class decoupled from other variations in the class.
Strive for loose coupling.
Strive for high cohesion.
Be absolutely meticulous in applying the once and only once rule.