Problem Analysis  «Prev  Next»
 Lesson 13 Modeling generalization Objective Apply generalization and specialization to define an inheritance hierarchy.

# Application of Modeling Generalization

Generalization is a technique for organizing information about objects according to the similarities and distinctions within the set of objects. Generalization is unlike any other kind of association. Associations describe how objects are related to one another. Generalization ties together pieces of class definitions to create one complete class definition.

## Modeling Elements

Generalization uses classes and association lines that you already know. In addition, a triangle is placed at the superclass end of the association instead of an association name. The discriminator is placed on the association line between the superclass and subclasses.

## Concepts to watch for

Whenever the problem statement and use cases attempt to describe objects in terms of what they have in common and what distinguishes them, you should start thinking about generalization.
Look for phrases like:
1. Kind of: "We offer six different kinds of kinds of accounts." "The Z Plan is another kind of corporate account."
2. Type of: "We support three types of clients..."
3. Like...but: "Status X is like preferred customer status but with a different qualifications."
4. similar...but: "This product is similar to product X but with a different widget assembly."

### Application

To apply generalization, identify the properties that the objects have in common and the properties that make them different. Let's step through the process used to develop the Customer generalization used earlier.

1. Begin with a problem statement that describes customers
2. Identify the properties of customer from the problem statement
3. Place all properties into a class definition
4. Select a subclass for each value of the discriminator
5. Create a subclass to the superclass with a generalization association
6. Identify the properties that are not common to all types of customers.
7. Please note that this example used only attributes. However, the process includes distribution of operations and methods (operation implementations) as well.