Skip to main content

Generalisation and Classification

In this section we are going to work through an example in the course text UML Distilled - 3rd Edition pages 75-76. This provides an excellent example of the differences between classification and generalisation. Let's consider the following phrases describing a dog called Shep.

  1. Shep is a Border Collie.
  2. A Border Collie is a Dog.
  3. Dogs are animals.
  4. A Border Collie is a Breed.
  5. Dog is a Species.

Notice the "is a" term. In some cases this can be used to determine whether the relationship between two classes is that of generalisation. Generalisation is transitive therefore we should be able to combine these phrases. Let's have a look at what happens when we do.

Works for...

Shep is a Dog (1+2)

Border Collies are Animals. (2+3)

Shep is an animal (1+2+3)

But...

Shep is a breed. (1+4)

A Border Collie is a species. (2+5)

As you can see this didn't work for all phrases. This is because some of the phrases were classification whereas some, the ones that worked, were generalisation.

Some of the phrases were classification

Shep is an instance of Border Collie

Others were generalisation

Border Collie is a subtype of Dog

This example highlights that generalisation is transitive whereas classification is not. In short be careful when using the "is a" test to determine if there is an area of generalisation.