Abstraction and generalization of objects

Abstraction is the process of removing details of objects. We step back from concrete objects to consider a number of objects with identical properties. So a concrete object can be looked at as a “superset” of a more abstract object.

A generalization, then, is the formulation of general concepts from specific instances by abstracting common properties. A concrete object can be looked at as a “subset” of a more generalized object.

In other words:

  1. For any two concepts A and B, A is an abstraction of B if and only if:
    • Every instance of concept B is also an instance of concept A
  2. For any two concepts A and B, A is a generalization of B if and only if:
    • Every instance of concept B is also an instance of concept A
    • There are instances of concept A which are not instances of concept B

So we have the following: \text{Abstraction} \subset \text{Object} \subset \text{Generalization}

I found this answer from StackOverflow to be really helpful, especially with the images:

Abstraction Object Generalization

As usual, some examples:

  1. In the following PHP class definition, a Vehicle is an abstraction of a Car
    <?php
    class Car extends Vehicle {}
    
  2. One of my earlier posts Generalized average is a generalization of the simple average method because it fulfills the conditions above, per the definition of generalization. If you set W to be all 1’s, you will get the simple average method, but the generalized formula also covers other cases
  3. If we consider the objects Semigroup, Monoid, and Group from Haskell then we have the following: \text{Semigroup} \subset \text{Monoid} \subset \text{Group}. So if Monoid were a concrete object, then Semigroup would be its abstraction (because it contains less properties than Monoid, but the ones it has already belong in Monoid) and Groupoid would be its generalization (because it has additional properties on top of the ones from Monoid)

Update: As mentioned by /u/BayesMind on Reddit, “[abstraction and generalization] are the same concept, namely the throwing away/ignoring/hiding of details”. The same reasoning is used in Abstraction in Computer Science. Further, as the Reddit user notes, “I would reorder your hierarchy of cakes as: A Cake < Cakes in the Abstract < The Concept of Foods, where the latter 2 are both more abstract/general than A Cake".

I have to admit myself that I've been using the words abstraction/generalization interchangeably, so I would say I agree with the statement above 🙂

One thought on “Abstraction and generalization of objects

Leave a comment