9.1. Concept of a Lifecycle

Each instance of a class generally has a lifetime. Objects are created, they progress through certain stages, and then go away. Their behavior is a progression through various stages over time. These changes over time are known as the lifecycle of the object.

As an example of a lifecycle, let's consider a light bulb. When power is applied, the bulb (if properly installed) goes on. When power is removed, the bulb goes off. Eventually the filament breaks and applying power has no effect.

Figure 9.1 shows a representation of the light bulb's behavior.

Figure 9.1. Lifecycle of Light Bulb

This simple pattern of dynamic behavior ...

Get Executable UML: A Foundation for Model-Driven Architecture 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.