Classification and Generalization

Classification and Generalization

I often hear people talk about subtyping as the "is a" relationship. I urge you to beware of that way of thinking. The problem is that the phrase "is a" can mean different things.

Consider the following phrases.

  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.

Now try combining the phrases. If I combine phrases 1 and 2, I get "Shep is a Dog"; 2 and 3 taken together yield "Border Collies are Animals." And 1 plus 2 plus 3 gives me "Shep is an Animal." So far, so good. Now try 1 and 4: "Shep is a Breed." The combination of 2 and 5 is "A Border Collie is a Species." These are not so good.

Why can I combine some of these phrases and not others? The reason is that some are classification (the object Shep is an instance of the type Border Collie), and some are generalization (the type Border Collie is a subtype of the type Dog). Generalization is transitive; classification is not. I can combine a classification followed by a generalization, but not vice versa.

I make this point to get you to be wary of "is a." Using it can lead to inappropriate use of subclassing and confused responsibilities. Better tests for subtyping in this case would be the phrases "Dogs are kinds of Animals" and "Every instance of a Border Collie is an instance of a Dog."



 
ASPTreeView.com
 
Evaluation has ЖА»Лexpired.
Info...