An 8th + Object Oriented Programming
Command objects or methods promote polymorphism while reducing queries to enforce encapsulation.
This technique pushes responsibility down into objects, reducing coupling.
When creating value objects, it is essential to remember that they are intended for querying purposes only. This approach simplifies our parameters, reduces coupling, and enhances code clarity, cohesion, and flexibility.
To improve encapsulation, always return self-objects that can be queried about themselves. However, there may be exceptions to this rule, such as in the case of value objects where certain information must remain hidden.
Small objects encapsulate specific behaviors and break down complex tasks into manageable pieces.o
Value objects are objects whose equality is determined by their property values, reducing duplication in the system by consolidating attributes. It is important to note that value objects are immutable, and attempting to instantiate invalid objects can cause unexpected issues.
Immutability promotes stability by preventing side effects.
Representing valid cases using value objects can eliminate ambiguity caused by Test-Doubles.