Unified Modelling Language (UML) Notes

Page Contents


Class Diagrams

Class As A Model

A class is something that groups objects with similar characteristics. For example, the class Animal groups dogs, cats, giraffes etc. into the group labelled "animal". I.e it is a model.

A class defines the abstract idea or concept of the group it represents. The class Animal, for example, defines the idea of an animal. This idea is a model, which means that it does not capture absolutely everything possible about an animal. It only captures characteristics relevant to the domain in which it is being used. For example, for a kennel, it might only need to capture an ID, name and owner. For a veterinary surgery it would need to capture even more detailed characteristics like blood type. This is what is mean by "domain": the context in which the class is being used.

A class is an abstraction. For example, all the characteristics of a real animal are not represented in the model, only those required. The other real-world characteristics are abstracted away. The kennel, for instance, doesn't need to know the blood type of the animal, so does not represent that in its model of an animal. The surgery, however, does so would not abstract it away. Thus the level of abstraction depends on the domain.

One other bit of modelling jargon is the "intent" of a class. This is the definition of class membership. For example, in the veterinary surgery, Animal represents the set of animals that are registered with the surgery, not the the set of all animals.

What I have called "characteristics" are referred to as "attributes" in UML. As well as its name, an attribute has a type, multiplicity and may also have additional properties such as {readOnly} etc.

This is what the UML spec has to say about modelling:

... A model is always a model of something. The thing being modeled can generically be considered a system within some domain of discourse. The model then makes some statements of interest about that system, abstracting from all the details of the system that could possibly be described ...




Ternary and Association Classes


... Sometimes a Property is used to model circumstances in which one instance is used to group together a set of instances; this is called aggregation ...

none Indicates that the Property has no aggregation semantics.
sharedIndicates that the Property has shared aggregation semantics. Precise semantics of shared aggregation varies by application area and modeler.
compositeIndicates that the Property is aggregated compositely, i.e., the composite object has responsibility for the existence and storage of the composed objects.

Composite aggregation is a strong form of aggregation that requires a part object be included in at most one composite object at a time. If a composite object is deleted, all of its part instances that are objects are deleted with it.

NOTE. A part object may (where otherwise allowed) be removed from a composite object before the composite object is deleted, and thus not be deleted as part of the composite object.

Inheritance, Constraints & Generalisation Sets

UML State Machines