Java = new ProgrammingLanguage()

"Java: A simple, object-oriented, network-savvy, interpreted, robust, secure, architecture neutral, portable, high-performance, multithreaded, dynamic language."

[JS96]

This is how JavaSoft, the Java-related organization of Sun Microsystems, describes the new programming language in its White Paper.

 

I don't want to explain each of these "buzzwords" in detail, as other authors do [see FLA96, pp. 4-9], but only those that were relevant for my decision to use Java as the language for the implementation of my classes.


Werbung

Simple


Java isn't a completely new language. Its syntax and constructs look very familiar to those in other languages like C or C++, what makes learning easy for programmers of these languages (I've experienced that by myself).

 

By speaking of a simple language, it is meant that some (critical or rarely used) features of C or C++ are no longer present in Java. Examples for such simplifications are that Java doesn't support struct or union constructs or multiple inheritance.

 

Flanagan mentiones other advantages that Java provides:

"Perhaps the most important simplification, however, is that Java does not use pointers. Pointers are one of the most bug-prone aspects of C and C++ programming. Since Java does not have structures, and arrays and strings are objects, there's no need for pointers. Java automatically handles the referencing and dereferencing of objects for you. Java also implements automatic garbage collection [sometimes...; author's remark], so you don't have to worry about memory management issues. All of this frees you from having to worry about dangling pointers, invalid pointer references, and memory leaks, so you can spend your time developing the functionality of your programs."

[FLA96, p. 5]

These facts indeed make Java a lot easier to work with than other languages do.

 

Working with Java does not neccessarily require programming experience in other languages, although it would be helpful. I think, it's also a good way for novices to make first steps in programming.

Object-oriented


When working with Java, you can't help but going the object-oriented way, for nearly everything in Java is an object.

 

As Flanagan describes it:

"Unlike C++, Java was designed to be object-oriented from the ground up. Most things in Java are objects; the simple numeric, character, and boolean types are the only exceptions."

[FLA96, p. 6]

To provide a quick approach, the Java API offers a lot of already designed classes, arranged in packages.

 

The packages of the JDK, Version 1.0.2, are the following:

java.lang

Package that contains essential Java classes, including numerics, strings, objects, compiler, runtime, security, and threads. This is the only package that is automatically imported into every Java program.

 

java.io

Package that provides classes to manage input and output streams to read data from and write data to files, strings, and other sources.

 

java.util

Package that contains miscellaneous utility classes, including generic data structures, bit sets, time, date, string manipulation, random number generation, system properties, notification, and enumeration of data structures.

 

java.net

Package that provides classes for network support, including URLs, TCP sockets, UDP sockets, IP addresses, and a binary-to-text converter.

 

java.awt

Package that provides an integrated set of classes to manage user interface components such as windows, dialog boxes, buttons, checkboxes, lists, menus, scrollbars, and text fields. (AWT = Abstract Window Toolkit)

 

java.image

Package that provides classes for managing image data, including color models, cropping, color filtering, setting pixel values, and grabbing snapshots.

 

java.peer

Package that connects AWT components to their platform-specific implementations (such as Motif widgets or Microsoft Windows controls).

 

java.applet

Package that enables the creation of applets through the Applet class. It also provides several interfaces that connect an applet to its document and to resources for playing audio.

[GY96]

The classes within these packages can be used as the base for own programs to be written. In addition, the source codes of all classes are freely available and may be studied by advanced programmers to understand Java in detail.

Network-savvy


This aspect is probably the one, which made Java such a popular language.

 

Since the past few years, the World Wide Web has caused some kind of enthusiasm all over the world. Everybody speaks of the "Global Village" and the "Information Superhighway". And Java supports the requirements of distributed applications perfectly.

 

Providing the neccessary classes and routines for network-wide operations in the java.net package, Java makes programming for the Internet much more easier than it was in languages as C and C++.

 

For instance, connecting to a resource and transmitting its content can now be done the same way as opening and reading a local file.

 

Besides, the possibility of integrating Java programs into Web pages in form of applets is a great and useful way to visualize different subjects, users can interact with over the net.

Architecture neutral


As mentioned before, Java was designed to support "programming for the Internet". Because the Internet is an Open System, consisting of a large number of different computer systems, you need applications that are running on any of these systems.

 

Gone are the times where software had to be rewritten/recompiled if it should run on a different architecture, as Flanagan explains:

"[...] Java programs are compiled to an architecture neutral byte-code format. The primary advantage of this approach is that it allows a Java application to run on any system, as long as that system implements the Java Virtual Machine. Since Java was designed to create network-based applications, it is important that Java applications be able to run on all of the different kinds of systems found on the Internet."

[FLA96, p. 8]

From the developer's view this means a great improvement, because the specific properties of different systems (like numeric representation or threads control) have not to be worried about any longer. This leads to faster software development.

 

Once an application had been written and compiled on, for example, an IBM PC running Windows95/NT, the produced byte-code runs also on a UNIX workstation or a PowerPC Macintosh without any modifications. Using the classes of the java.awt package, the application also has the appropriate look for each system.


After all that praising, a few words must be said about Java's "other side":

 

They speak of high-performance. You probably don't agree to that statement immediately, but there is a reason why Java programs seem to run slowly.

 

"Java is an interpreted language, so it is never going to be as fast as a compiled language like C. In fact, Java is on the average about 20 times slower than C. But before you throw up your arms in disgust, be aware that this speed is more than adequate to run interactive, GUI and network-based applications, where the application is often idle, waiting for the user to do something, or waiting for data from the network."

[FLA96, p. 8]

A real disadvantage of Java that might lead developers to frustration is obvious, when a user interface is to be implemented.

 

Java provides so called "Layout Managers" for different purposes that are very hard to work with.

For example, if you want to arrange layout components in a window, there is no possibility to specify absolute coordinates. Instead, you have to deal with relative positions, what permanently leads to "funny" results. (Don't ask me, how long I worked on the tiny Parameters window of the sample applet. A "relative" long time...)

 

But the Java language specification is changing constantly.

While writing these pages, the new JDK Version 1.1 had been announced, which will provide some additional packages and, hopefully, removes the lacks of previous releases.

Neural Net Components in an Object Oriented Class Structure