Backgrounder

About Object-Oriented Programming Languages

Our goal in programming is to solve problems in code. In object oriented (OO) programming, we abstract a problem in terms of things called objects. An object is a uniquely identifiable programmatic entity that retains its own data. An object also defines behaviors that can be managed by sending it messages through a published interface. The data that an object can store and its definitions for behavior are defined by a programmer in a construct called a class.

 

Object-oriented languages all depend on the concept of class libraries. These are sets of classes that can be used by developers as a common foundation for building complex applications. In some cases, the class library is a standardized part of the language (Python); in other cases, class libraries can vary depending on the "dialect" of the language (Smalltalk) or on the vendor providing the language (early C++). Object-oriented programming languages have been around longer than you think: over 30 years!

 

Alan Kay gets the most credit for kicking things off, having come up with the Smalltalk language somewhere around 1970, based on his experiences with Simula. Simula came out of the Norwegian Computing Center in Oslo in the mid-1960s. It introduced the OO concepts of objects and classes, as well as inheritance and dynamic binding.

Smalltalk is a simple language where everything is an object. The minimal syntax in Smalltalk is all centered around the simple idea of sending a message to an object to tell it to do something. Here's some Smalltalk syntax:

 

Object Message

 

Learning the rest of Smalltalk syntax is a 15-minute exercise. The bulk of Smalltalk behavior is defined through its extensive class library, not its syntax. Unfortunately, it's all downhill from there, folks. OO languages took on more syntax and became more complex as time went by.

 

The dominant languages of the 70s and 80s-COBOL, FORTRAN, and C-were all procedural. As application needs got more complex, so did the ability to effectively manage the complexity with these procedural languages. C begat C++, the first of many C-based object-oriented languages.

 

C++ was the brainchild of Bjarne Stroustrup, who developed it from 1983-1985 while working at Bell Labs. C++ was an attempt to retain the power of C while allowing management of application complexities through objects. Notably, C++ is a superset of C. It has a large syntax and is difficult to master.

 

Many other lesser-known object-oriented languages surfaced around the mid-80s. Most of these have retained a very small niche in the software development community. Some of these languages are summarized in the following table.

 

Language

What's Interesting About It

Objective C

designed by Brad C. Cox; championed the idea of interfaces. goal: to add main features of Smalltalk-80 to C

Eiffel

created by Bertrand Meyer; not just a language but also a method incorporating the idea of design by contract

Dylan

designed by Apple; allows programmer control over level of typing

Self

a classless language; does not distinguish state from behavior

 

Other interesting OO languages include BETA, Cecil, NewtonScript, Prograph, and Sather. Also around this time, Smalltalk first became commercially available.

 

The 90s saw a huge surge in popularity of C++ and to a lesser extent Smalltalk. In C++, we saw attempts at standardization of the language and its class library. New constructs such as RTTI (runtime type identification), namespaces, and templates were introduced to meet modern development demands.

 

Many of the other main procedural languages that survived into the 90s-Pascal, COBOL, Ada, Fortran, LISP, and Basic-were enhanced with object-oriented capabilities as we realized that objects were "here to stay.". These languages are still viable choices, but consider that a clean break to a new language can help developers avoid the trap of writing procedural code with a thin object veneer. There is also considerable benefit to using a language that was actually designed from the ground up to support the object-oriented paradigm.

 

Things changed dramatically and rapidly as the internet quickly dominated the development scene. Java, invented by James Gosling at Sun, was originally devised as an embedded language, but gained prominence as a web development language around 1995. Part of the design goal of Java was to provide familiar C and C++ constructs, minus the dangers of C and the complexities of C++. Note that it is neither a superset of C nor a subset of C++.

 

Java was also designed to run on most operating systems without the need to even recompile. Like Smalltalk, this is accomplished through the use of a virtual machine (VM). The simplification goal meant that Java allowed only single inheritance (also like Smalltalk) instead of C++'s multiple inheritance. Pointer manipulations were eliminated, in favor of garbage collection based memory management (again, like Smalltalk).

Java began as a language, but has recently evolved into a complete enterprise development platform called J2EE, supporting distributed computing, web development, database interaction, etc.

 

Understanding of how to best develop with objects also began to improve in the 90s. Important development concepts such as design patterns and test-first design first began to catch on at this time. Design ideals, such as the open-closed principle and the dependency inversion principle, were espoused by people such as Bertrand Meyer and Barbara Liskov. Bob Martin of Object Mentor gathered these into a coherent set of guiding design principles.

 

C#, designed by Andres Hejlsberg, came about as Microsoft's answer to Java, and in fact looks a lot like Java. Unlike Sun's evolution of Java into J2EE, Microsoft had the hindsight to realize that the enterprise framework should be considered before the language, and came up with .NET as a result. One of the most significant achievements in .NET is that Microsoft's other language offerings (primarily C++ and Visual Basic) have been retrofitted to produce a common set of intermediary byte codes upon compilation. This means that all applications can be executed with a common VM, allowing for ultimate portability and interoperability.

 

The other excitement today is around a couple of object-oriented scripting languages, Python and Ruby. Both are dynamically-typed languages, like Smalltalk. Python has some procedural underpinnings, while Ruby is a pure OO language.

 

Our view is that dynamic languages like Python and Ruby represent the direction things should head: as we learn how essential test-first design is to software development, we realize that static typing in languages is more of a barrier. We trust our tests to ferret out defects; the value-add of static typing and other language protections is minimal.

Object Mentors have significant experience in Java, Smalltalk, Python, Ruby, C++, and C#. We also know a bit about other OO languages, such as Self and Objective-C. We know the ins and outs of these languages and can help your development shop learn to use these tools properly.

 

References