We learned a lot in this chapter about how important it is to always validate the data our application produces and works with.
Specifically, we covered:
- How to use attributes to decorate the properties of the entities in the domain model and use the added metadata to validate those entities.
- The usage of always valid entities and value objects. We learned that this convention cannot only be used to validate data that the users enter into the system, but also to significantly reduce the complexity and size of our code base.
- How to address more complex validation requirements by using special validator classes. By implementing classes that have only the responsibility of validating the data entered by the users, we follow the single responsibility ...