Chapter 4. Manipulating objects
This chapter covers
- Making a distinction between mutable and immutable objects
- Using modifier methods to change state or create modified copies
- Comparing objects
- Protecting against invalid state changes
- Using events to track changes in mutable objects
As you’ve learned in the previous chapters, services should be designed to be immutable. This means that once a service object has been created, it can never be modified. The biggest advantage is that its behavior will be predictable, and it can be reused to perform the same task using different input.
So we know that services should be immutable objects, but what about the other types of objects: entities, value objects, and data transfer objects?
4.1. Entities: ...
Get Object Design Style Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.