Comparing Object-Oriented Languages
This is the forty-first installment in a series of articles about fundamental object-oriented (O-O) concepts and related object-oriented technologies. The material presented in these articles is based on material from the second edition of my book, The Object-Oriented Thought Process, 2nd edition. The Object-Oriented Thought Process is intended for anyone who needs to understand basic object-oriented concepts and technologies before jumping directly into the code. Click here to start at the beginning of the series.
In keeping with the code examples used in the previous articles, Java will be the language used to implement the concepts in code. One of the reasons that I like to use Java is because you can download the Java compiler for personal use at the Sun Microsystems web site http://java.sun.com/. You can download the standard edition, Java SE JDK 6, at http://java.sun.com/javase/downloads/?intcmp=1281 to compile and execute these applications. I often reference the Java J2SE 5.0 API documentation and I recommend that you explore the Java API further. Code listings are provided for all examples in this article as well as figures and output (when appropriate). See the first article in this series for detailed descriptions for compiling and running all the code examples (http://www.developer.com/design/article.php/3304881).
For this article, you will compare and create code for three object-oriented languages: Java, C# .NET, and Visual Basic .NET. For information on the tools used to compile the .NET code, please visit the Microsoft web site at http://www.microsoft.com/net/Basics.mspx.
The code examples in this series are meant to be a hands-on experience. There are many code listings and figures of the output produced from these code examples. Please boot up your computer and run these exercises as you read through the text.
In future articles, you will explore specific differences in these languages; in this article, I will provide a framework code set to provide a baseline for moving among various languages, not just the three that you explore here. Although you focus on these three languages in this article, it is helpful to first explore what it means to be an object-oriented language.
Structured and Object-Oriented Development
One historical fact that surprised me when I started programming with object-oriented languages was the fact that object-oriented programming history actually parallels that of structured programming. I had originally assumed that object-oriented design was a totally separate design methodology. Even today, I encounter many people who assume that object-oriented development and structured development are two totally distinct paradigms—an either-or proposition.
The truth of the matter is that both development paradigms are alive and well, and that the object-oriented paradigm in fact incorporates the major structured programming concepts within its design.
I contend that in any introductory programming class, you must teach the following fundamental software design concepts:
- Data Structures
- If Statements
These first four bullet items are inherent to structured programming. The fact that they also are fundamental to object-oriented development indicates that the object-oriented discipline did some significant borrowing, or at least co-development. Thus, to learn how to program with objects, you also must learn the primary structured concepts.
Although most developers can identify many structured programming languages—such as Fortran, COBOL, Basic, C, and so forth—not many can trace the development of object-oriented languages. Take a quick look at the evolution of object-oriented languages, many of which you will see in this and future articles.
What really makes a programming language object oriented? And, when did the object-oriented movement really start? Many people point to the early 1960s as the time when Simula-67 introduced the concept of an object.
As the name implies, Simula was created to aid in simulations. It is not a coincidence that simulations typically model real-world systems. Many of these real-world systems contained hundreds, or thousands, of interacting parts.
The initial version of the language, Simula-1, was introduced in 1966. The programming modules defined by Simula were based not on procedures, but on actual physical objects. Simula had a novel way of presenting the object, so that each object has its own behavior and data.
Many consider that the first truly O-O language was Smalltalk, developed at the Learning Research Group at Xerox's Palo Alto Research Center in the early 1970s. In Smalltalk, everything is really an object that enforces the O-O paradigm. It is virtually impossible to write a program in Smalltalk that is not O-O. This is not the case for other languages that support objects, such as C++ and Visual Basic (and Java, for that matter).
C++ has its roots in a project to simulate software running on a distributed system. This simulator, actually written in Simula, is where Bjarne Stroustrup conceived of the idea of combining some of the features of Simula with the syntax of C.
While working at Bell, Stroustrup made personal contacts with people such as Brian Kernighan and Dennis Ritchie, who wrote the definitive book on C. When the initial simulator written in Simula failed, Stroustrup decided to rewrite it in a C predecessor called BCPL.
C++ was originally implemented in 1982 under the name C with Classes. As the name suggests, the most important concept of C with Classes was the addition of the class. The class concept provided the encapsulation now requisite with O-O languages.
Java's origins are in consumer electronics. In 1991, Sun Microsystems began to investigate how it might exploit this growing market. Some time later, James Gosling was investigating the possibility of creating a hardware-independent software platform for just this purpose. Initially, he attempted to use C++, but soon abandoned C++ and began the creation of a new language he dubbed Oak.
By fall 1995, Java beta 1 was released, and the Netscape Navigator 2.0 browser incorporated Java. Java 1.0 was officially released in January 1996. Over the past several years, Java has progressed to the current release Java 2 Platform Standard Edition 6.0 as well as other platforms such as an Enterprise Edition (J2EE) for the enterprise/server market and a Micro Edition (J2ME) for mobile and wireless.