Design Concepts  «Prev  Next»
Lesson 7 Generalization
Objective Define Generalization as it applies to Modeling Objects

Define Generalization Modeling Objects

When modeling a problem domain, you often run across objects that are similar but not entirely the same. We use words like
  1. type or
  2. kind
to describe their relationship. For example, a truck is a type of vehicle, a plane is a kind of vehicle. If all the properties of truck and plane were the same, then they could be instances of the same class. But they share only some properties.
In this case, you can generalize the shared properties, that is, you can place them in their own separate class called “vehicle” and inherit them. The unique properties of trucks and planes go into their own classes. To follow through with the example, you would need to combine all the properties of the vehicle class and the truck class to create an instance of a truck.
The SlideShow below describes an instance of generalization:

1) Running Programs 1 2) Running Programs 2 Program 1 Program 2
Generalization Vehicle Class
The term generalization is also used another way. A generalization is the structure, that is, a class hierarchy, that you get when you organize the class definitions using the processes of generalization and specialization.

Generalize and specialize

To generalize means to identify the properties that a group of objects have in common. To specialize means to identify the properties that distinguish similar objects from one another.
Generalization supports the logical grouping of similar objects that we often use when we think and talk about objects. It allows the introduction of new objects without redefining the properties it shares with related objects already in a model.
Generalization is classified as an association. However, be careful to recognize that generalization is unlike every other type of association. Every other type of association may be instantiated as a link between two objects. In contrast, a generalization connects two class definitions that must be used together to instantiate a single object.