Classifiers and Instances
Some types of element (such as Classes) model classifications, which provide a specification of an abstract concept. For example, the concept of a Building can be represented by a set of Classes that define types of building such as Bungalow, Miner's Cottage, Office Block, Shop and so on. Other types of element (such as Objects) model instances of such classifications, such as 23 High Street Shop or 45 Village Green Cottage. The instance elements represent actual objects in a run-time scenario, based on the specification of the classifier element. For example:
- An Object element represents a man called Joe Smith, as a specific instance of the concept of 'a person' defined by the Class element Person; the object is rendered as a rectangle showing the name of the classifier - if you name the object it becomes <ObjectName>:<ClassifierName> or, in this example, Joe Smith:Person
If you develop a Person Class with attributes such as Age, Name, Address and Sex, and functions such as GetAge and GetName, then when you derive an object from that Class the object takes on all the Person Class behavior and state (as well as inherited state and behavior from the parent elements of the Person Class, if any).
Associating an instance with a classifier greatly increases the descriptive power of the model in capturing the functionality and responsibility of objects and their associated state at run-time. This is a powerful means of moving your model from the analysis phase into detailed design.
In this way you can associate Sequence diagram objects with Classes and use the defined behavior of the Class to model actual behavior at run time; the same concept applies to Messages for a State Flow connector