Skip to content

Generalization

Knut Jetlund edited this page May 12, 2016 · 7 revisions

Home Modelling


Introduction

Generalizing into superclasses and dividing into subclasses is an important and valuable part of domain modelling. The use of inheritance between classes reduces duplication in the model and makes sure common concepts are treated in the same manner.

An example of subclasses and superclasses is shown in the figure. Vehicle is a superclass over the subclasses Car and Train.

Dividing into subclasses

Two good rules for testing if it is correct to divide into subclasses: 100% rule: subclass conform to all of the superclass's required attributes and associations Is a-rule: In natural language test the sentence subclass is a superclass

Generalization into superclasses

.... often, a superclass will be abstract, while the subclasses are the ones that are implemented.