Evolution to Java & Swing                                  Peter Komisar
                                                                                                                                                                latest revision  July 16 / 2001 .c

references: 'Design Patterns',Gamma,Helm,Johnson&Vlissides,'Thinking in Java',
Bruce Eckels, 'Just Java' ,P.Linden, 'Operating Systems',  Tanenbaum & Woodhull


The Co-evolution of PCs, GUIs, Languages & Object-Oriented Thinking

The following discussion is an attempt to portray the developments that were taking place
in computing that lead to the creation of the environment in which the Java language was
born. Understanding Java in this context provides a better insight into what Java is and
how it came to be.

Evolution of the Machine

Just for a landmark, Tanenbaum and Woodhull note the first true digital computer was
designed by Charles Babbage (1792 - 1871). Babbage spent most of his life trying to
make it work. It never worked right because of it's entirely mechanical design. From
the same source, Babbage hired the daughter of the British poet, Lord Byron, Ada
Lovelace, to create a form of software that would be used to direct the machine.
// They might have used the scroll model used to control player pianos.

By the mid-forties, giant computers that filled rooms were built using vacuum tube
technology. Despite their size, they were slower than today's cheapest computers.
In these days, the machines were programmed in absolute machine language. A
programmer would sign in to use the computer and actually bring  his or her own
plug board to manipulate the machine. At this point in time, the idea of programming
languages didn't exist yet.

By the mid 50s computers were reliable enough to be manufactured and sold but only
universities, governments and large corperations could afford their multimillion dollar price
tags. To run a job, a programmer would first write the program by hand in FORTRAN
or ASSEMBLER, then punch  the program onto punch cards. The cards would then
be handed to an operator working in the input room. If the Fortran compiler was needed,
the operator would go to a cabinet and take out a tray of punch cards holding  the Fortran
compiler and read it into the machine. An inexpensive machine could be used (IBM 1401)
to read the cards which would copy the results to tape. The tape would be read by an
expensive computer (like an IBM 7094) which would output to tape. The tape then
would be carried over to another 1401 and output would be sent to the printer.
 

A Short Aside Leading  to Unix

By the 1960s the first computer designed to run both commercial and scientific computers
were invented, the IBM 360. It was built using integrated circuits (ICs). An enormous
and extremely complex operating system was designed to coordinate it's activities, OS/360.
Later MIT, Bell Labs and GE embarked on the development of the computer utility
designed to support hundreds of simultaneous time sharing users. The system was called
MULTICS (Multiplexed Information and Computing Service). The designers envisioned
a huge machine providing computing power to everyone in Boston. Eventually Multics ran
on dozens of sites and had enormous influence on subsequent operating systems.

At this time the mini-computer was becoming popular starting with the DEC PDP-1.  At
$120,000 a machine they 'sold like hot cakes', (using the words of Tanenbaum & Woodhull)
Ken Thompson, who had worked on MULTICS, set out to write a stripped down, one
user version of MULTICS to run on a PDP-7. This would later become the UNIX operating
system.
 

The beginnings of Graphical User Interfaces

The most famous location associated with the beginnings of graphical user interfaces was
the Xerox Research Center at Palo Alto California (PARC). In fact, many computer scientists
were experimenting with graphical user interfaces at this time. One of the oldest references to
a graphical system is a PhD thesis written by I.E. Sutherland in 1963 called 'Sketchpad: A
Man-Machine Graphical Communication System.'. J. Raskin in his 1967 thesis argued
that computers should be all-graphic, creating characters graphically and in various fonts so
what you see on screen is what you get. (WYSIWYG). His thesis, "The Quickdraw System"
would provide the moniker for Apple's Macintosh GUI drawing toolbox.
 

Personal Computer Advances Made GUIs Viable

From the debut of the IBM PC in 1982, the power of the PC is increased steadily in processing
speed memory capacity. Using graphical user interfaces would probably have stayed an academic
exercise, without the great strides the PC computer technology. PCs made the wide scale use
of graphical user interfaces feasible and now what we consider to be the norm.
 

Evolution of Computer Languages

It should be said that the limits of early computers put many constraints on the pioneer writers
of computer languages. In the earliest, pre-language days of computing, it was necessary to
optimize all the memory the system had to offer. It is telling that the recent Y2K bug derived
from early designers saving two bytes of memory in describing the year in the computer's clock.
The emphasis was on the efficient use of memory and processor ability.

Advances in memory and cpu technology gradually allowed designers to take coding to
higher language levels, gradually changing the focus from how the machine sees things to
how people see things. Eventually, computer progress allowed developers to take a graphical
approach to interfacing man to machine. Continuing advances and economies in hardware
allowed graphical user interfaces to move from the academic to wide scale, commercial use.
The focus on graphical user interfaces in turn helped to alter how computer languages were
evolving.

Writing graphical components led to the observation that many problems were recurring that
begged for better solutions. For instance, many essentially similar graphical components were
needed over and over again. A solution was needed to allow code to be easily reused.
Another observation, was that various graphical components might differ in the detail of their
appearance but essentially were the same device. A button is very much like a checkbox for
instance. Rather than reworking a new but essentially similar component, a way of extending
the general characteristics of one control to another would also be helpful. Essentially the
components of the new GUIs were perfect candidates for the new object-oriented design
approach that appeared at this time. The object-oriented thinking itself was the result of
an evolution of thought in computer languages.
 

The Growth of Abstraction

Bruce Eckel in his text 'Thinking in Java' describes the 'progress of abstraction'. Assembly
language he states is a small abstraction of the underlying machine. Command languages like
FORTRAN, BASIC, PASCAL and C are abstractions of Assembly. These higher level
languages provide great advantages over Assembly but still required the programmer to adapt
problems to the way the computer 'thought' rather than being free to consider the problem
free of this restriction, as a human thinks. The effort required a mapping to take place of the
problem from the human problem domain to the machine domain. The whole process led to
a lot of error prone code that was difficult to write, read to maintain.

The next step in language evolution was to focus the language syntax on modeling the problem
versus the machine. Early languages like LISP, APL and PROLOG used themes to model the
world into programs. Lisp was based on the premise that all problems were lists, APL that all
problems were algorithmic in nature. PROLOG modeled problems as chains of decisions.
The approach taken by these languages made them inherently limited in what type of problem
they were suited to solve.

The object-oriented approach is a higher degree of abstraction providing a means for describing
problem almost entirely in terms of the problem itself. The connection back to the computer is
done through the definition of objects. Objects serve to interface the world perception to the
machine, where real world characteristics and behavior map to computer language states and
operations.

Alan Kay, an Apple distinguished Fellow, and OO expert states Simula-67 was the first OO
language having been developed circa 1967. The first successful object-oriented language was
Smalltalk enjoying widespread popularity and is one of the languages on which Java's based.
Eckel uses Alan Kay's summary to describe the five basic characteristics of Smalltalk.

1. Everything is an object
2. A program is a group of objects messaging each other.
3. Each object can be made up of other objects.
4. Every object has a type. Each object is a class instance where class is synonymous with type.

C++

About the time SmallTalk was released in 1980,  Bjarne Stroustrup, working at the AT&T
Bell Labs began adding object-oriented extensions to the C language. He designed C++ so
that it could be translated to run to be compiled on a C compiler. By the late 80s and early
1990s, C++ was in popular use.  Java was, in large measure,  built on C++, using the same
C style syntax but removing elements that have proven to be error prone or problematic.
 

Model View Controller Architecture

In Smalltalk-80 the Model/View/Controller triad of classes was used to build the user
interfaces. The Model is the application object, the View,  it's screen representation and
the Controller the way the user interface reacts to user input. Decoupling these parts of a
component was new at the time and added a great deal of flexibility to the GUI. For instance
in a music program, midi data (representing pitch, volume, note time length, type of voice)
can be represented in different views, one perhaps as a piano scroll another as a musical score.
The same data is used to produce different views. Another example might be data for a chart
where a  number of variables represent percentages. The percentage data can be represented
in a bar graph or as a pie diagram or simply in a table. Again one set of data is represented in
different views.

This model has been widely copied. Microsoft uses an almost identical system except adding
a Document object. The swing components, derivatives of Netscape's Internet Foundation
classes have also been modeled using Smalltalk's Model View Controller Architecture.
 

Design Patterns

" Clients should be able to create a window without committing to a concrete implementation
  Only the window implementation should depend on the platform on which the application runs.
  Therefore the client code should instantiate windows without mentioning specific platforms."

 quote from  'Design Patterns', Gamma,Helm,Johnson&Vlissides, discussion of the Bridge Pattern

This quote is from the widely referenced text, 'Design Patterns'. This quote is right in step
Java's approach which on a grand scale treats each platform as an concrete implementation
of an abstract java virtual machine, or JVM.

The Design Patterns book was published in 1995. It is a way of thinking in objects at the
framework level. The book describes a methodology for abstracting and identify often used,
programming and framework patterns. The book describes a set procedure for cataloging
these patterns to facilitate their reuse. The book describes 23 such patterns that recur
regularly in programming. These patterns are frequently referenced in Java literature.

The Design Patterns text provides a great snap shot of the culmination of object-oriented
thought prevalent during the time the Java language was written. (It would still have been
called Oak then). In fact many of the patterns and nomenclature found in the Design Patterns
text are evident in the Java API as it exists at present. (Java wasn't released at the time the
Gamma, Helm, Johnson, & Vlissides book was published. These authors used SmallTalk
and C++ to example their patterns.)

Conclusion: Java In Context

The landmark releases of SmallTalk in 1980 and the IBM PC in 1982 marked the beginning
of a partnership of machine, object-oriented thinking and graphical user interfaces. This trend
by 1990 had grown into the mainstream of computing language thinking. Add the release and
popularization of the C++ programming language and you have a picture of the historical and
intellectual context from which James Gosling would be writing Java.

Gosling's finished product, Java, is a product of it's time. It inherits many of the best ideas of
object-oriented thinking that have co-evolved in partnership with graphical user interfaces and
computer hardware. The Java swing API is an applied example of a Graphical User Interface
based on the model view controller architecture which originated in Smalltalk. The design
patterns illustrated by Gamma and company are evident in many places in the Java libraries.
Java builds on Bjarne Stroustrups extension of the C language, C++. Java is clearly a great
example of a work being inextricably tied to the context in which it was created.


Appendix

UML  // the beat goes on

The Design text also references work by OO pioneers like James Raumbaugh and Grady Booch
whose object modeling techniques, along with those of Ivar Jacobson,  provide the basis for the
Unified Modeling Language (UML) being administered under the auspices of the Object
Management Group (OMG).  UML is a language independent, visual modeling language which
promises to nurture new trends in object-oriented thinking. The three amigos are active from
within their company Rationale.