next up previous print clean
Next: Expressiveness Up: Why Java? Previous: Why Java?

Ease-of-Use

Java is easy to learn and fun to use. In contrast to C++, Java does not use pointers and includes automatic garbage collection. Java does not permit multiple inheritance and operator overloading. Currently, Java does not support a template mechanism; however, a a keyword generic is reserved for a possible future implementation.

Java wraps a general programming language, a graphics-, and networking toolkit into a single consistent framework. Java comes with a large well-designed and pragmatic object library (e.g. hashtables, IO streams, and GUI buttons). Java has no C-like header files but its own package inclusion scheme that makes Java programs available on the world wide web. Furthermore, Java's naming scheme is intuitive and consistent. Java's decision to derive every class from a single root class, Java.Object, gives the package a unified concept. However, Java includes wisely a few primitive data types, such as floats or integers, for which an object implementation is often inefficient and superfluous.

Determenism. Java was built to be reliable. The creators of Java specified a virtual machine and ensured that Java programms change the state of that machine entirely deterministically. Consequently, Java includes strong typing, array bound checking, and other language controls. The thorough language specifications and the determinism of its programs, enables the compiler to detect more errors at compilation time, and the run time system to deliver a precise error stack of any runtime error.

Tools. Java's documentation tool Javadoc produces standardized HTML pages from comments in any Java source code: an important step towards Knuth's literate programming paradigm.

Java has its own up-to-date mechanism (checksource flag of the Java compiler) for source files.

Availability We program on personal computers, workstations, and supercomputers. Quickly after Java's introduction, Java compiler were available on all platforms that we are using. For many platforms we can now choose between vendor compilers and third party compilers. Furthermore, most popular Internet browsers (Netscape, Internet Explorer) include a Java compiler. Finally, Java's integration into all popular Web browsers helps a programmer to publish and exchange his software.

Overall, the software industry and especially the personal computer vendors seem to invest into Java technology. Unfortunate for the scientific community, Java's development is driven mostly by non-scientific applications. It seems unavoidable that many future computer technology advances will be driven by the growing consumer market of personal computing, rather than the proportionally shrinking scientific computing. Consequently, the scientific and engineering community should take advantage of mass-market technologies, avoid expensive specialized tools, and attempt to influence the available tools to avoid the most flagrant short comings. As Professor Kahan pointed out with a $1000 price tag per Fortran line only the federal government can afford it. (Kahan: ACM invited talk). Java critics within the scientific community (CIP article) have pointed out that the sales of Java developer environments make only a small fraction of the total market. I argue that among the mass-market programming languages, Java is the most attractive one for scientists. In other words, Java probably outsells Fortran90 developer environments. It sure outranks Fortran shelf space in technical bookstores.

Portability. We move programs from machine to machine. As time passes computers are replaced. As we move around from job to job our hardware changes. Over time new compilers and developer environments become available. Nothing is more frustrating than fixing software that ought to work.

Java was designed to be portable. Since Java is defined for a virtual machine, only this virtual machine specifications (its instruction set) has to be ported. Once the virtual machine is available, Java will execute. To make Java safe and verifiable, Java is specified so that its possible states are entirely deterministic and therefore the code can be verified to be harmless to the client computer. SUN attempts to protect Java's purity by testing any Java's compiler's ability to execute standard Java before. We have ported the Jest library to two platforms and two browsers without a single portability problem. Furthermore, we changed between minor and major - 1.0 to 1.1 - compiler versions without any complications. We know of three Jest installations and nobody has reported Java portability problems. However, Jest relies mostly on parts of Java that are traditional language features, such as arithmetic operations, string handling, stream IO, etc. We heard about portability problems with more innovative parts of the language, such as the window toolkit AWT.

A friend, Bill Harlan, pointed out how a language is finally standardized just as it becomes obsolete: C, C++, Java. In the mythical man month, Brooks  suggests that a project the moment it is finished it is aging. In contrast, Java attempts a more evolutionary approach. SUN reserves the right to add new classes and to remove obsolete ones. During a transition period, Java compilers support new as well as deprecated language features. However, when encountering a deprecated feature, the compiler warns the programmer. Such an evolutionary approach to software maintenance encourages incremental changes to existing programs and may proof superior to the traditional ANSI standardization process that attempts to fix a language forever but usually requires catastrophical changes after a decade of stagnation.

Correctness. We enjoy writing a program, but we hate to debug it. Java is a language that catches many errors during compilation time. Additionally, subtle language features such as object libraries package support, its naming conventions, its documentation tool Javadoc, prevent many errors from being programmed in the first place. Dijkstra , the man who slayed the goto statement, points out that those who want really reliable software will discover that they must find means of avoiding the majority of bugs to start with, and as a result the programming process will become cheaper.

Libraries. We want to build upon the time-tested programs of others when we can: Java comes with a large set of packages that include a graphics toolkit, networking programming, threads, and a database interface. Rapidly, additional expert classes are being developed and become available. Because of Java's portability these classes are quickly downloaded and tested. Additionally, Java's simplicity, naming conventions, and documentation gives all packages a consistent programmer interface.

Furthermore, Java provides a standard mechanism to invoke C subroutines. Consequenly, we may not need not abandon our time tested C- and Fortran routines after all.

A potential reason to shun Java is its current rapid growth and change. Java is not standardized and past releases changed sufficiently to require considerable reprogramming of already existing applications. In particular, Java's window toolkit, AWT, has been undergoing drastic changes. However, Java's core libraries (list here ???) have been stable.


next up previous print clean
Next: Expressiveness Up: Why Java? Previous: Why Java?
Stanford Exploration Project
3/8/1999