When the chronicle of computer languages is written, the following will be said:
B led to C, C evolved into C++, and C++ set the stage for Java. To understand
Java is to understand the reasons that drove its creation, the forces that
shaped it, and the legacy that it inherits. Like the successful computer languages that
came before, Java is a blend of the best elements of its rich heritage combined with the
innovative concepts required by its unique environment. While the remaining chapters
of this book describe the practical aspects of Java—including its syntax, libraries, and
applications—in this chapter, you will learn how and why Java came about, and what
makes it so important.
Although Java has become inseparably linked with the online environment of the
Internet, it is important to remember that Java is first and foremost a programming
language. Computer language innovation and development occurs for two fundamental
reasons:
■ To adapt to changing environments and uses
■ To implement refinements and improvements in the art of programming
As you will see, the creation of Java was driven by both elements in nearly
equal measure.
Java’s Lineage
Java is related to C++, which is a direct descendent of C. Much of the character of Java
is inherited from these two languages. From C, Java derives its syntax. Many of Java’s
object-oriented features were influenced by C++. In fact, several of Java’s defining
characteristics come from—or are responses to—its predecessors. Moreover, the creation
of Java was deeply rooted in the process of refinement and adaptation that has been
occurring in computer programming languages for the past three decades. For these
reasons, this section reviews the sequence of events and forces that led up to Java. As
you will see, each innovation in language design was driven by the need to solve a
fundamental problem that the preceding languages could not solve. Java is no exception.
The Birth of Modern Programming: C
The C language shook the computer world. Its impact should not be underestimated,
because it fundamentally changed the way programming was approached and thought
about. The creation of C was a direct result of the need for a structured, efficient, highlevel
language that could replace assembly code when creating systems programs. As
you probably know, when a computer language is designed, trade-offs are often made,
such as the following:
■ Ease-of-use versus power
■ Safety versus efficiency
■ Rigidity versus extensibility
Prior to C, programmers usually had to choose between languages that optimized
one set of traits or the other. For example, although FORTRAN could be used to write
fairly efficient programs for scientific applications, it was not very good for systems
code. And while BASIC was easy to learn, it wasn’t very powerful, and its lack of
structure made its usefulness questionable for large programs. Assembly language
can be used to produce highly efficient programs, but it is not easy to learn or use
effectively. Further, debugging assembly code can be quite difficult.
Another compounding problem was that early computer languages such as BASIC,
COBOL, and FORTRAN were not designed around structured principles. Instead, they
relied upon the GOTO as a primary means of program control. As a result, programs
written using these languages tended to produce “spaghetti code”—a mass of tangled
jumps and conditional branches that make a program virtually impossible to
understand. While languages like Pascal are structured, they were not designed for
efficiency, and failed to include certain features necessary to make them applicable to
a wide range of programs. (Specifically, given the standard dialects of Pascal available
at the time, it was not practical to consider using Pascal for systems-level code.)
So, just prior to the invention of C, no one language had reconciled the conflicting
attributes that had dogged earlier efforts. Yet the need for such a language was
pressing. By the early 1970s, the computer revolution was beginning to take hold, and
the demand for software was rapidly outpacing programmers’ ability to produce it.
A great deal of effort was being expended in academic circles in an attempt to create a
better computer language. But, and perhaps most importantly, a secondary force was
beginning to be felt. Computer hardware was finally becoming common enough that a
critical mass was being reached. No longer were computers kept behind locked doors.
For the first time, programmers were gaining virtually unlimited access to their
machines. This allowed the freedom to experiment. It also allowed programmers to
begin to create their own tools. On the eve of C’s creation, the stage was set for a
quantum leap forward in computer languages.
Invented and first implemented by Dennis Ritchie on a DEC PDP-11 running the
UNIX operating system, C was the result of a development process that started with
an older language called BCPL, developed by Martin Richards. BCPL influenced a