The Fruits of Civilization (11-1-2) Object Orientation

 Object Orientation

Object-oriented programming offers a sustainable way to write spaghetti code. It lets you accrete programs as a series of patches. ~ English programmer Paul Graham

In the early and mid-1960s Norwegian software scientists Ole-Johan Dahl and Kristen Nygaard took algol and gave it an object orientation. The result was Simula 67. As its name suggests, Simula was designed to run simulations.


Object-oriented programming (OOP) is a paradigm for developing software programs. The keystone of object orientation is encapsulation: making everything modular. In an object-oriented program, data is encapsulated in objects.

Objects are of a particular class. Each class typically defines 1 or more behaviors. An object is an instance of a class.

The term behavior has many synonyms: procedure call, routine, function, method, and message. They all amount to the same thing: code which does something with or to data; in the instance of OOP, data within an object.

A principal paradigm in object-oriented programming is inheritance: the ability of one class (a subclass) to employ (inherit) the behaviors of another class (the superclass of the subclass). The advantage of inheritance is its potential for reusability: what the goto statement aimed at, but without creating spaghetti code.

In OOP, base classes establish basic functionality, which subclasses inherit to further refine and specialize upon. For example, cWindow might provide the ability to display objects within an onscreen window. cWindow would be a superclass to cGrowWindow, a subclass that sports a grow behavior to enable resizing a window via a size box. cZoomWindow would then be a subclass to cGrowWindow; adding a zoom behavior that puts a zoom box icon on the window title bar which, when clicked upon, zooms a window to have it fill the screen. The zoom box acts as a toggle: if a window is already full screen, clicking the zoom control resizes the window back to take only the part of the display that it did before being zoomed.

Another important facet to object orientation is polymorphism: that different classes might have behaviors with the same name. A subclass may have a behavior that overrides a method defined in a superclass. (Polymorphism is sometimes inelegantly called function or method overloading.) Polymorphism simplifies the task of writing behaviors and takes advantage of the capability for inheritance. With polymorphism, generic behaviors may work on objects of any type. Polymorphism allows a generality in programming which cannot otherwise be achieved.

Operating systems present an application programming interface (API) that allows application software developers to connect with OS functionality through procedure call (behavior) names. Historically, this might involve many hundreds, if not thousands, of individual functions with different names. Polymorphism offers the potential to eliminate the inexorable clutter of an API presented by a structured programming language like C or Pascal.


The term object-oriented was introduced in the description of Smalltalk, an OOP language created by developers at PARC, particularly Alan Kay. With its English-like punctuation, Smalltalk was originally intended to be a language for “children of all ages.”

Smalltalk was more an environment than a language per se. As such, it did not make much of a commercial impact, but its concepts influenced many of the OOP languages that followed.

The problem with object-oriented languages is they’ve got all this implicit environment that they carry around with them. You wanted a banana but what you got was a gorilla holding the banana and the entire jungle. ~ American programmer Joe Armstrong

OOP became a paradigmatic virus to programming languages: all became infected. Even Fortran was extended with OOP constructs. Most OOP extensions to languages were afterthoughts: providing some convenience, but not remedying the deficiencies inherent in the language with regard to code maintenance. Some maladapted OOP extensions, such as C++, created problems for programmers rather than offering solutions.

50 years of programming language research, and we end up with C++? ~ American computer scientist Richard O’Keefe