Chapter One, Sethi

"A programming language supports a programming style if the style can be expressed, if conformance with the style can be checked and if the style is implemented efficiently." From Sethi p.207

Java:

The development of the Java language by SunMicrosystmes was heavily influenced by the capabilities and requirements of the internet. Java applications run over the internet, on customized hardware and on Java interpreters embedded in dog tags and smart cards. Syntactically Java is very similar to C/C++ however in many ways Java behaves more like the dynamic LISP and SmallTalk. The Java Sandbox (introduced in Java1.0) protects a local operating system and resources from untrusted code. Speed and portability are difficult to combine in a single language - code optimized to run fast on one platform is not easily moved to another. Java 1.2 introduced the java.security package which provides greater flexibility in assigning permissions. Some of the built in Permission subclasses are java.security.AllPermission and java.io.FilePermission.

Java comes in several flavors for use in various environments 2EE, 2ME, 2SE, MS's version, Swing, JavaBeans(a reusable software component that can be manipulated visually in a builder tool), JavaScript, Java Servlets etc. Like C and Pascal, Java is an imperative programming language (ie action oriented). The Java programming language from Sun is part of a continuing trend toward higher level programing languages.

Java removes some powerful low level details found in C and implements safeguards to reduce programmer error. Java removes error prone features of C and attempts to replace them with safer substitutes. During its early development Java was called "C++ minus minus"[Learning Java]. Java includes automatic garbage collection - not a new idea, LISP has had this for years. Java's garbage collection runs on a low priority thread quietly reclaiming unreferenced objects. Java also has extensive run time exception support.

Looking at the graph on p.14, Java superficially descended from C/C++ but also has a great deal in common with LISP and SmallTalk. Like Java, SmallTalk is compiled to byte code which is interpreted and compiled on the fly. Java improves on SmallTalk's design by introducing a byte code verifier which reduces the need for runtime checks of code correctness. The benefits in page 7 of Sethi all apply here. The benefits of code reuse are accepted and sought after more so than 20 years ago. Java reduces some of this error-prone features of C.

Code reuse is formalized and encouraged through Java libraries. There are over 1500 predefined classes guaranteed to be included in every computer running Java. Widely accepted naming and capitalization conventions help make Java code universally readable. In addition a plethora of tools and free source code from Sun and third parties is available to the programmer.

Language Implementation:

Java classes are compiled in to byte code which is then run by the JVM interpreter. The JIT (Just in Time) compiler dynamically compiles the code just before it is executed to help improve performance. Sun's HotSpot technology analyzes Java code use as it runs and compiles frequently used portions into fast native code. Java is the first interpreted language which achieves speed comparable to a compiled language. This is accomplished in part through the JIT compiler which optimizes the code for the local architecture.

The designers did make some concessions to backwards compatibility, at the cost of program clarity. For example, to allow backwards compatibility to C style array declarations, the following three code snippets are all legal declarations of two dimensional arrays of characters:

char[][] array

char array[][]

Unfortunately the following is also legal (as well as misleading):

char[] array[]