There's Something About Java Compatibility

Java's Role In Enterprise Computing Leaves Some Things To Be Considered

Clearly, Java provides tactical advantages in specific situations. It has introducednovel solutions for very specific problems, such as security. And we all want to see Javaevolve into the enterprise-wide, strategic development environment that its advocates havetalked about from the start. Don't we?

By now, you're probably beyond asking, "Why Java?" If not, you should havediscovered that programmer productivity and platform independence is the answer. But,"At what price?" is the question for the 21st century.

The value of Java to a programmer is productivity; the way it allows developers togenerate easily maintained, clean source code that can go into production quickly. This ispossible because the Java programming language provides application developers thelow-level granularity of languages like C and C++, combined with high-level features likesecurity, object-orientation and garbage collection.

Spaghetti Code
From a language perspective, Java does not use pointers, freeing developers fromcountless lines of code to manipulate them. Although this is considered by many to be thebest feature of the Java language, others (typically steeped in Assembler or C) feel thatprogramming without pointers is like spaghetti without meatballs. They can't imagine achange from the traditional recipe.

Java's garbage collection algorithms provide a good example of advanced functions.Java's creators had the foresight to free developers from the mundane task of allocatingand deallocating memory for their application. Garbage collection saves significantdevelopment time for most production applications.

However, some purists argue that active and efficient memory management makes garbagecollection irrelevant. The garbage collector has also been accused of poor performance dueto untimely collection. Scheduling garbage collection is crucial and as a result, SunMicrosystems has delivered newer versions of the garbage collection algorithm. This changeshould mitigate these performance problems.

Productivity is a significant factor influencing the popularity of Java as aprogramming language, but the greatest number of lines of Java code are written because ofits platform independence.

The notion of "write once, run anywhere" grabbed everyone's attention threeyears ago, but in reality, "write once, test everywhere" is a more accuratedescription of distributed Java applications. What's interesting is that the Java languageitself does not prevent applications from being easily ported.

However, the implementation of the Java virtual machine (JVM) on specific platforms andbrowsers does create idiosyncrasies that application developers must deal with. Combinedwith the breakneck speed at which Sun Microsystems is issuing new releases of the Javalanguage, developers can find deployment of distributed Java applications very tricky.

Vive La Difference? Not!
Fortunately, there are a number of ways to minimize the differences among JVMs. If anapplication is browser-enabled and you can determine which of the two prominent browsersare used, writing the application to suit that browser makes sense. Granted, this will notwork when the user's browser is unknown.

Sun is attempting to address this issue directly with new components such as the JavaPlug-in. The Plug-in allows applications surfaced by a browser to replace the browser'svirtual machine selectively with a virtual machine from Sun Microsystems.

By downloading Java virtual machines from the Web, the Plug-in provides the specificversion of the Java virtual machine that an application requires. This process allowsdevelopers to bypass the problems caused by multiple vendors providing different virtualmachines. The availability of the Java Plug-in is a boon to ISVs like SAS Institute (Cary,N.C.) who need to balance the creation of stable production quality software with therapid pace of change. Java applications that are executed from the command line requiremore effort because there is no equivalent of the Java Plug-in for standaloneapplications.

Execution Methods
Currently, there are three ways to ensure compatibility with different platforms:
  1. Distribute the JVM of your choice with the application, guaranteeing execution of your Java code. This increases the size of your deliverable and impacts installation and maintenance.
  2. Distribute different Java bytecodes for each platform that you want your application to support. This choice makes Java seem just as difficult to use in heterogeneous environments as any other language.
  3. Write your application to comply with the 100 percent Pure Java test suite, and have it tested for logo certification.

While applications that are logo certified are not guaranteed to run with all JVMssupplied by JavaOS licensees, you greatly increase the probability of platformindependence.

Java programmers may experience higher productivity measured in clean lines of codeproduced. However, the Java language uses different memory management and pointerconventions, requiring veteran programmers to adopt new techniques. And the wide range ofdecisions necessary for application portability demonstrates that platform independencecomes at a cost.

--Chip Kelly, a member of SAS Institute's Java Futures Committee, isalso the Institute's program manager for Web Enablement.