Skip to content

Abstraction

Objects are designed to be abstractions of real world entities. Abstraction is the process of taking the essence of something to create a representation.

Let’s create an abstraction of a dog. A dog is an animal, it has four legs and a tail, two ears, two eyes, it can bark, walk, run, roll over, and so on. Similarly, a drawing of a dog is an abstraction.

This is the process we use when designing classes of objects. You imagine the thing you want to create and give it things it will need to know and things it will be able to do.

In software there is nothing stopping you creating a dog with five arms, six hands, and fifteen teeth. As this does not sound like a dog, it should have another name. A good abstraction should aim to be true to the thing you are trying to represent.

When thinking about your own objects you should think about the things related to the program, and try to model these as classes.

Abstraction is the process of focusing on key aspects of something. With object-oriented programming this involves creating classes that represent real world entities.