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 a Class and as a State Machine

graphics/09fig12.gif

Just as a class has instances, so a state machine also has instances. A state machine instance refers to the execution of a state machine by a particular object. Think of a state machine instance as a private copy of the state machine that is executed by a single object. Each state machine instance is in exactly one state at a time.



Executable UML. A Foundation for Model-Driven Architecture
Executable UML: A Foundation for Model-Driven Architecture
ISBN: 0201748045
EAN: 2147483647
Year: 2001
Pages: 161

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net