Since its public introduction a little more than a year ago, tremendous hype and fanfare have surrounded the Java programming language. Rumors, speculation, and confusion have all followed the wave of Java publicity. Is it secure? Is it just for the Web? Is it robust? As Windows NT 5.0 takes shape, Microsoft is preparing an important place for Java and other Web-related technologies (for information on NT 5.0, see the list of related Windows NT Magazine articles on page 116). To understand Java for what it is and what it isn't, you have to know a little bit about Java's origins and cut through the myths.
Java's Reason for Being
Java is a general-purpose OOP language, but many users associate it with the Internet. The Internet connection came relatively late in Java's gestation and was not its original purpose. Sun Microsystems developed Java while working on projects for intelligent appliance such as personal digital assistants. James Gosling led the development group, which started its work in C++, but became frustrated with some of C++'s limitations.
Beginning in 1990, the development group began working on a new language, the Object Application Kernel (OAK). Because OAK was already a registered trade name, Sun Microsystems renamed its new language Java. Like most technology developments, Java has origins in other languages. C and C++ contribute the most, but Smalltalk, Objective-C, Eiffel, Ada, ML, and SNOBOL also have elements in Java.
Truth About Java
Many claims have been made about Java as a language. By examining these claims, you can begin to better understand Java's place in the world of development technologies.
Simple. Java is the simplest OOP language to learn. By comparison, the learning curves for other OOP languages such as C++ and non-OOP languages such as C are very steep. What will happen to Java after the standards committees take hold of it is difficult to say. Despite its simplicity, Java is an OOP language, so you need to gain some understanding of object-oriented concepts.
|What it is, and what it isn't|
Efficient. The claim that Java is efficient is debatable because Java is an interpreted language, and the Java interpreter uses the Java Virtual Machine (JVM). You can interpret Java to run on any operating system or Web browser, so a Java program will typically run between 2 and 20 times slower than an equivalent C++ program. However, for an interpreted language, this performance is considered efficient.
Several companies (including Borland and Symantec but excluding Sun Microsystems) recently deployed a relatively new concept to help with Java's runtime efficiency: Just-In-Time (JIT) compilation, which involves invoking a compiler at runtime from within the JVM on precompiled Java byte codes that have had all dynamic bindings resolved. The JIT compiler re-compiles the interpreted byte codes into machine code, which speeds subsequent execution. Technologies such as JIT, advances in general-purpose computing hardware such as the Pentium Pro, and the Sun Microsystems announcement of Java silicon (processors that execute Java directly) will make Java a more effective general-purpose computing language. The first examples of Java silicon and the JavaStation are due out in 1997.
Small. The Java language is small. The number of keywords and language constructs is limited compared with other development languages. The compiled code that Java produces is also compact relative to the number of input source lines, which makes it good for quick downloading across the Internet.
Architecture Neutral. Java's language characteristics are absolute across all platforms, which makes Java programs extremely portable. Java does away with the 16-, 32-, 64-bit conundrum because the basic data types are the same size regardless of platform. So, for example, you can write a Java program on Windows NT that will run on a Solaris SPARC machine without so much as a recompile. This portability includes graphics programs. Anyone who has had to architect and construct portable graphics code, even with a helper toolkit, will appreciate Java's portability.
Secure. Java's claim to be a secure language is in dispute because hackers have successfully cracked its security mechanism dozens of times. Sun Microsystems is revising Java to use independently verifiable digital signatures to enhance Java's security. These enhanced features will be part of the next major release of the language.
Robust. Several of Java's elements make it one of the most robust languages ever developed. Because Java has no undefined states, you're less likely to encounter a protection fault or clobbered memory. In contrast, when a program written in C or C++ references a pointer to an invalid memory location, the language does not define what action to take and the program can become unstable. Java also has a well-designed exception mechanism that performs many checks at compile time. The exception mechanism can catch and easily handle runtime exceptions. In addition, the lack of pointers combined with extensive compile time analysis eliminates many traditional coding errors, making for very solid code.
Multithreaded. Java contains embedded support for multithreaded programming. Some of the support is in the language in the form of keywords supporting mutual exclusion locks and semaphores, both of which are necessary for effective multithreaded programming. Some of the support is in the class library that comes with the language. Although multithreaded programming is inherently difficult, Java's support for it makes it simpler than ever before by providing an easy-to-use language and library mechanisms.
International. All character and string data types in Java are Unicode. Unicode is a standard that supports wide characters capable of representing any one of the natural languages (you can find complete information about Unicode at http://www.unicode.org).
Because of its presence on and off the Web, Java is aiming to become a dominant application development language in the next few years and figures to play an important role in NT 5.0. The application development community, including NT development shops, will largely determine Java's success. For more information on Java, see the box, "Java Resources."