9.6. Lifecycles for Classes

Recall the definition of a class.

A class is an abstraction of a set of real-world things such that

  • All the real-world things in the set—the instances—have the same characteristics (“common characteristics”).

  • All instances are subject to and conform to the same rules and policies (“common behavior”).

Since all instances of the class must follow the same rules of behavior, when we abstract a group of like things to produce a class, we also abstract their common behavior pattern into a lifecycle typical of the class. The lifecycle provides a formal description of the behavior pattern shared by each of the objects, called a state machine, as illustrated in Figure 9.12.

Figure 9.12. Correspondence between Abstraction as ...

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.