The Evolution of Object-Oriented Languages
This series, The Object-Oriented Thought Process, is intended for someone just learning an object-oriented language and wants to understand the basic concepts before jumping into the code or someone who wants to understand the infrastructure behind an OOP language they are already using. 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 J2SE 1.4.2 SDK (software development kit) to compile and execute these applications and will provide the code listings for all examples in this article. I have the SDK 1.4.0 loaded on my machine. I will provide figures and the output (when appropriate) for these examples. See the previous articles in this series for detailed descriptions for compiling and running all the code examples in this series.
In the last column, we explored the components of a classwhich is the basis for all object-oriented development. The class is the fundamental object-oriented unit. All objects are created from classes, so it important to understand the structure of a class. Improperly designing a class will have negative effects throughout the development process. In fact, it is the design of classes that has fueled the development of various object-oriented languages. Many people are surprised to learn that several popular languages are not actually object-oriented (like C++ and VB 6)they fall into a category called object-based. In the case of C++, you can actually create an application that conforms to object-oriented principles; however, a C++ compiler must be able to compile C syntaxand C is definitely not an object-oriented language. Thus, the C++ compiler does not enforce object-oriented design.
In this article, we will explore the history and evolution of object-oriented languages so that you will have a better understanding of what makes an object-oriented language tick. Surprisingly, although many people believe that O-O technologies are fairly new, O-O languages have their origins in the early 1960s. In fact, much of the history of structured and O-O programming overlaps to some degree.
What really makes a programming language an O-O language? And when did the O-O 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. We will follow O-O language evolution through the discussion of several O-O languages. Many point to Smalltalk as the first pure O-O language. Interestingly enough, C++, perhaps the first major commercial O-O success, is not truly O-O. And finally, you will learn why Java was released with such fanfare and what makes its proponents consider it a complete programming language package.
By the 1960s, programmers realized that programming systems needed to be broken up into small, manageable pieces. The introduction of Simula-67 brought with it the first true programming object, classes, and a form of inheritance; therefore, Simula is an important milestone in any discussion on O-O programming languages. The language was designed by Dahl, Myhrhaug, and Nygaard at the Norwegian Computing Center at Oslo, Norway. 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++ and Java Are Not Purely O-O|
|C++ has O-O features, but you can use non-objects in C++. Java is mostly O-O, but the primitive data types, such as integers and floats, are not implemented as objects.|
Smalltalk is actually much more than a programming language: It is a programming environment. In fact, Smalltalk is an interactive environment that interprets code on-the-fly. You can actually change the parameters and code of a program while the program is running.
Smalltalk first introduced many other concepts that would later appear revolutionary when implemented in other applications, such as browsers, windows, and pop-up menus. From the O-O perspective, Smalltalk supported inheritance and the concept of sending messages between objects. Smalltalk gained a loyal and vocal following, but initially did not make major gains in the programming market.
Although Smalltalk gave O-O development a certain amount of legitimacy in the marketplace, it took C++ to bring O-O development what it really needed: widespread acceptance in the marketplace. For this reason, C++ may well be the most important O-O language. Not until C++ was released and the industry started supported it with a vengeance did O-O development become mainstream.
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.
The reasons C++'s O-O roots are in Simula are obvious. However, why did Stroustrup decide to use C? Because, he said, C is flexible, efficient, available, and portable. Some of these points can be debated today, but at the time, these reasons were valid. Perhaps the most important reason he used C was because he was at Bell Labs and C had gained a large following and was widely accepted in the marketplace.
Commercial C++ compilers began to appear in 1988. In June 1989, C++ Release 2.0 legitimately moved C++ into the mainstream of software development; in late 1989 the ANSI C++ committee formed.
While C provided a solid foundation for C++, it also was also a bit of a boat anchor. Using C syntax provided a clear transition path from C to C++; however, making C++ backward compatible with C has a serious drawback. While C++ does provide O-O constructs, it is possible to use structured programming techniques. Thus, C++ is not considered a true O-O language, but a hybrid language. During job interviews, many O-O novices will proclaim their competence with O-O languages by alluding to the fact that they have used a C++ compiler. The issue here is that you can use a C++ compiler while programming with straight C syntax. In short, you can use a C++ compiler and not conform to accepted O-O programming rules.
An interesting point about C++ is that a large percentage of the software that currently runs on PC-based systems is written in C++. Also, much of embedded system work is still done with C and C++. C++ remains a very powerful language where performance is at a premiumalong with, obviously, assembler. A very disciplined programmer can create very elegant object-oriented programs with C++.
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.
Gosling decided that he still wanted to base his language on the highly successful C++, but that he would incorporate only those features of C++ that were deemed worthwhile. The features that he eliminated from the C++ plate were multiple inheritance, automatic type conversions, the use of pointers, and C++'s memory management scheme. Although the Oak technology was intriguing, the market was not quite ready for it and Oak was put on the backburner.
With the advent of the Web and the emergence of browsers, the people at Sun put two and two together, and Oak was brought out of the mothballs and renamed Java. Sun created its browser, called HotJava, using Java. By summer 1995, Java ran on SPARC Solaris, Windows NT, Windows 95, and Linux. 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 nine years, Java has progressed to the current release Java 2 Platform Standard Edition 5.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.
Microsoft responded to the popularity of Java by producing a version of Java called Visual J++. However, Microsoft decided on a more comprehensive response. Using many of the groundbreaking that Java implemented, Microsoft developed a language called C# that became the foundation for the companies .NET platform. As with Java, C# relied heavily on the success and failures of earlier languages. The .NET development environment includes many of the really good characteristics of several other platforms. C#, like Java, uses C/C++ syntax. C# incorporates many of concepts introduced by the initial Java released (which I will list later in the article). The C# platform also builds upon many of the powerful features of the VB6 and Visual C++ environments.
While Java hangs its hat on the fact that it is platform independent, perhaps the most interesting point about C# is that is takes this portability thread in a totally different direction. With the release of the .NET environment, Microsoft moves into the realm of language portability. Whether or .NET will ever be truly platform independent, it does provide the ability to develop code in different languages that can be integrated into the same application. For example, you can develop objects in C# .NET and VB .NET and use them together. In fact, any objects developed in the .NET environment can be used together.