Logical View  «Prev 

UML Generalization

A generalization is a directed relationship between a more general classifier (superclass) and a more specific classifier (subclass). A typical example of generalization involves the personal and corporate customers of a business. They have differences but also many similarities. The similarities can be placed in a general Customer class (the supertype), with Personal Customer and Corporate Customer as subtypes. This phenomenon is also subject to various interpretations at the various perspectives of modeling. Conceptually, we can say that Corporate Customer is a subtype of Customer if all instances of Corporate Customer are also, by definition, instances of Customer. A Corporate Customer is then a special kind of Customer. The key idea is that everything we say about a Customer:
  1. associations,
  2. attributes,
  3. operations
is true also for a Corporate Customer.
From a software perspective, the obvious interpretation is inheritance:
The Corporate Customer is a subclass of Customer.
In mainstream OO languages, the subclass inherits all the features of the superclass and may override any superclass methods.

Dog Generalization Diagram

1)To start the model,begin with the Dog class.
To start the model,begin with the Dog class.

2) Identify the discriminator for the next level of differentiation or specialization, for example, Breed.
Identify the discriminator for the next level of differentiation or specialization, for example, Breed.

3) Connect all of the Breed level classes to the Dog class using the generalization type of association,
Connect all of the Breed level classes to the Dog class using the generalization type of association, the triangle at the superclass end of the association.

4) Place the discriminator on the generalization line.
Place the discriminator on the generalization line.

5) To further specialize the hierarchy, select the discriminator for the next level.
To further specialize the hierarchy, select the discriminator for the next level. For example, break down Breed into sub-breeds, or sub-classes of the Spaniel class.

6) Connect the new sub-classes to the Spaniel class, again using the generalization symbol.
Connect the new sub-classes to the Spaniel class, again using the generalization symbol. Place the discriminator on the generalization line.