You are previewing Domain-Driven Design: Tackling Complexity in the Heart of Software.

Domain-Driven Design: Tackling Complexity in the Heart of Software

Cover of Domain-Driven Design: Tackling Complexity in the Heart of Software by Eric Evans Published by Addison-Wesley Professional
O'Reilly logo

Six. The Life Cycle of a Domain Object

Every object has a life cycle. An object is born, it likely goes through various states, and it eventually dies—being either archived or deleted. Of course, many of these are simple, transient objects, created with an easy call to their constructor, used in some computation, and then abandoned to the garbage collector. There is no need to complicate such objects. But other objects have longer lives, not all of which are spent in active memory. They have complex interdependencies with other objects. They go through changes of state to which invariants apply. Managing these objects presents challenges that can easily derail an attempt at MODEL-DRIVEN DESIGN.

Figure 6.1. The life cycle of a domain object

The best content for your career. Discover unlimited learning on demand for around $1/day.