Object-oriented programming has the advantage of being a natural paradigm in which to develop systems. We perceive the world as consisting of objects: tables, chairs, computers, cars, bank accounts, rugby matches, and overdrafts. It is also a natural human trait to try to organize these objects, arranging them into some form of classification, choosing to highlight certain features of objects in preference to others. So, dogs and cats are mammals, toasters and refrigerators are appliances, rugby and tennis are sports, Jaguars and Fords are cars, trucks and cars are vehicles, and so on.
There can be many levels to these categories and many ways to classify the objects in the world. How people classify things depends to a large extent on what they want to do with them and the features that are salient to these desires. For example, an electrical engineer is likely to have different, and in some ways deeper and richer, categories for household appliances than a teacher might have. While grouping objects into classification schemes, we also tend to highlight certain attributes of objects in preference to others. For example, a car’s color might not matter in an engineer’s mind, but it might figure heavily in a Ferrari salesperson’s mental model of car classifications.
The idea of building hierarchies of related objects is used in object-oriented programming. As long ago as the 1960s, researchers realized that many computer program model entities can be named and their properties and behavior can be described. They noticed that programs deal with data such as bank accounts, arrays, files, and users, which are analogous to objects in the real world.
Object-oriented programming can crudely be characterized as identifying the relevant objects, organizing them into hierarchies, adding the attributes to the objects that describe the relevant features in the problem context, and adding the functions (methods) to the objects to perform the required tasks on the object. The details are a little more complicated, but essentially, it is a simple and natural process.
Yet simple and natural doesn’t necessarily mean easy. A collection of objects could be classified in virtually countless ways. The ability to identify the important attributes of objects and to form good abstractions and appropriate hierarchies is key. Even within the context of a problem domain, it’s sometimes hard to determine the correct levels of abstraction and suitable classification hierarchies. Just deciding which class or grouping an object belongs to can be very difficult. As Wittgenstein (1953) pointed out, some objects will bear more of a family resemblance to a concept than others; for example, rugby and tennis are more obviously sports than are chess and synchronized swimming.