9.5. Forming Lifecycles

Building good state machines takes practice. Here are two reminders to help you avoid traps.

The model is an abstraction.

Just as a class diagram doesn't model every fact about a thing as an attribute, so the state machines will capture only those stages and progressions that are relevant to the problem at hand. The light bulb model doesn't include its manufacture, sale, or disposal. These things do happen to a light bulb, but they are (presumably) outside the scope of the problem we're modeling.

Similarly, a light bulb takes time to heat up and is fully on only when the filament has reached a certain temperature. For most problems, this view is overly detailed and fails to abstract unnecessary detail. These decisions ...

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.