Picasso would be really proud

Introduction

The upcoming article series will deal with the basic concepts of object oriented programming. Be aware that if your programming language does allow the instantiation of objects does not necessarily mean that you are working object oriented.

Object oriented programming comes with a lot of advantages and use cases. But all of them are based on the so called four pillars of object oriented programming. These are:

In this article I am going to go into more detail about abstraction. In object oriented programming the process of only exposing relevant or necessary features is called abstraction. Think of a car. You as the driver are responsible of shifting the gear, accelerating and breaking. But you do not need to know how the gears or the pedals work inside the car. By only revealing the pedals, the gear knob and the steering wheel the car does an excellent job of hiding irrelevant features from the user.

A more programming based example is the storage of preferences. The API user only sees

[pastacode lang=”java” manual=”save(String%20key%2C%20Object%20value)” message=”” highlight=”” provider=”manual”/]

but does not need to worry about what happens inside the Preferences.class. Whether the preferences are stored in a database, a xml file or written down by tiny little creatures living inside your computer gets hidden away.

Ways to achieve abstraction are topic of the following article about encapsulation.

What have we learned?

To sum it all up abstraction is the process of only exposing essential features while hiding irrelevant details.

Categories: Blog Posts