Specialisation

Sunday, 12 May 2002
Martin Fowler martinfowler.com describes dynamic classification in his book UML Distilled (Chapter 6, Multiple and Dynamic Classification). UML Distilled, by Martin Fowler A quote: A dynamic classification dynamic classification is useful for conceptual modelling

Fowler supplies an example:
a person can change job.

Hm, I agree with the largest part of Fowlers' book, but dynamic classification is sheer nonsense to me. In addition I find the example of a person's job rather weak.

Yes, a person-manager could be modelled as specialisation. But could is not should. Three points against dynamic classification:

  1. A conceptual model should reflect reality, not possible implementations.
  2. The class of an object is valid for the entire lifetime of an object, from construction till destruction.
  3. A specialisation has nothing to do with properties that change value during the lifecycle.

Association or Specialisation?

Fine, no dynamic classification for me. But what to use, an association or specialisation? And what makes the difference?

In my Nut's weekly of 15 October 2001 the answer as To be or to have? That is the question.. At the bottom of that story you will find a quiz that teases you with different meanings of "is".

Fowler mentions these confusing meanings of "is" in chapter 6, section Classification and Generalization.

As an alternative he offers a question such as
Is every instance of Manager an instance of Person?

That questions remains vague too, does not clearly distinct association from specialisation.

Distinction question: Is cardinality meaningful?

Idea: Look whether cardinality could apply. For example: An association and a specialisation
  • What would happen if the history of a person's jobs would be within the scope?
  • What would happen if one person could have multiple jobs simultaneously?
This kind of hypothetical changes of cardinality is a good test for a specialisation.
  1. A specialisation never has anything to do with cardinality. The following question is nonsense:
    How many Jobs is a Manager?
  2. An association always has cardinality. That can be one to one, but usually is one to many.

Till next week,
Nut