|
|
Thanks to Axel T. Schreiner.
Java is a new programming language developed at Sun under the direction of James Gosling. As far as possible it is based on concepts from C, Objective C and C++.
Java is interpreted and loads classes dynamically. There are CPU chips for Java; Sun showed a prototype Java computer early in 1996 and by now it is commercially available (if slow).
HotJava is a Web browser, that was implemented in Java using a modular architecture. It loads protocol modules and other applications (applets) dynamically from the local system or over a network and thus adapts to new tasks.
According to Hoff, Shaio and Starbuck, Java is ``simple, object oriented, statically typed, compiled, architecture neutral, multi-threaded, garbage collected, robust, secure, extensible and well understood. Above all, however, Java is fun!''
These terms are elaborated on below -- I do not quite accept all these claims, however...
Java is related to languages like C or C++, but to make the language small and easy to learn all inessentials were eliminated. This leads to more uniform programs and simpler maintenance.
Unfortunately, Java 1.1 introduced significant new, useful, but different concepts. There is a proliferation of libraries as various companies try to turn individuality into market dominance.
Modern programs are distributed and have graphical user interfaces. Both can be implemented more easily with object orientation. Unlike C++, Java is fully object oriented and thus furthers the right programming style for these problem areas.
All data must be declared with types so that data and operations may be matched as far as possible during compilation. Methods are dynamically bound but overloaded signatures are decided during compilation. Like Objective C, Java permits type queries and object analysis, e.g., for the existence of methods, using the package java/lang/reflect at runtime.
Unlike TCL, Java avoids repeated source analysis. A program is compiled into byte codes, the machine language of the Java Virtual Machine (JVM). The JVM is interpreted or compiled just in time. Classes and methods are bound symbolically, i.e., classes can be recompiled individually.
Byte codes are the same everywhere; only the JVM has to be implemented for a new platform. Java programs should run everywhere and can be distributed as binaries. Unlike C and C++, Java completely specifies the capacity and behavior of the primitive data types thus eliminating a serious portability problem.
Swing is implemented without any native code, relying only on the API defined in JDK 1.1.
Graphical user interfaces provide the illusion of parallel execution. Threads offer an elegant implementation. Java has a thread system based on classes and the language contains simple synchronisation mechanisms (monitors). Many class libraries are thread-safe.
Dynamic memory management as in C and C++, where the programmer attends to reusing resources, is efficient but error prone. Java only knows dynamic objects and vectors and completely frees the programmer from the problem of memory reuse. Garbage collection runs as a parallel thread and thus should not be a bottleneck in critical situations.
Exceptions are an integral part of Java for error handling. The programmer is constantly forced to consider error possibilities in libraries and the compiler can check that exceptions are not hidden or overlooked.
An interpreter can pretty much ensure that the interpreted program cannot crash it's platform. In connection with the Web, Java has additional security mechanisms that constrain foreign programs so that viruses are considered impossible -- in spite of the fact that binary Java programs can run on arbitrary platforms.
Various groups have demonstrated, however, that security holes do exist. There is a move toward digitally signed programs and distributed trust.
Java methods can be implemented in other languages using the Java Native Interface (JNI). In principle, arbitrary libraries can be accessed as long as other security or portability aspects do not prevail.
While Java is a new language it's concepts are well known. The language definition is comprehensive and still short. Unlike C++, a programmer can certainly understand Java completely and use all of it. Java's relationship to C and it's dialects makes it easy to get into the language, although there are a number of subtle differences to be aware of.
|
|
Created by
unroff,
java2html &
& hp-tools.
© by csfac. All Rights Reserved (2010).
It is not allowed to print these pages on a CAST printer.
Last modified: 01/April/10 (17:16)