1. Introducing Subtypes by Specialization

A new object type may be introduced by specialization whenever it represents a special case of another object type. We illustrate this for our example model where we want to capture text books and biographies as special cases of books. This means that text books and biographies also have an ISBN, a title and a publishing year, but in addition they have further features such as the attribute subjectArea for text books and the attribute about for biographies. Consequently, in Figure 12.1, we introduce the object types TextBook and Biography by specializing the object type Book, that is, as subtypes of Book.

Figure 12.1. The object type Book with two subtypes: TextBook and Biography
The object type Book with two subtypes: TextBook and Biography

When specializing an object type, we define additional features for the newly added subtype. In many cases, these additional features are more specific properties. For instance, in the case of TextBook specializing Book, we define the additional attribute subjectArea. In some programming languages, such as in Java, it is therefore said that the subtype extends the supertype.

However, we can also specialize an object type without defining additional properties or operations/methods, but by defining additional constraints.