Java Overview

Java's Language

Brief History

The life of Java began as a programming language to develop software for consumer electronic devices. David Flanagan lists such examples as toasters, microwave, ovens, and personal digital assistants. Because of so many different devices, and continual changing of chips as the chips improved, there was a set of requirements that the software generated would be able to move from one chip to the next with out any difficulty. A small team of programmer, lead by James Gosling, started research on how to many this software possible. The Gosling's team quickly realized that there was a given language that could be written for this task. Even high level languages such as C and C++ were not suitable. Also due to the complexity of C and C++, it was extremely difficult to write reliable software.

So the result was Gosling's team went off and started creating their own language that would not be platform dependent. The language they began to develop was known as Oak. Oak " was small, reliable, and architecture-independent" (Flanagan 4). Then in 1993 the World Wide Web comes along. The programmers of Java realized that their platform neutral language, it would the ideal Internet programming language. Java began to creep into HTML documents, which would provide interactive, executable contents on Web pages. By allowing another application to be embedded into another application, Web pages became more creative. When the software package is embedded within another, the first package is called an applet. The rest is history.

What is Java

"The Java language changes the passive nature of the Internet and World Wide Wed by allowing architecturally neutral code to be dynamically loaded and run on a heterogenous network of machines such as the Internet" (Ritchey 14). Sun Microsystems best describes the Java language in "The Java Language: A White Paper", as follows.
Java: A simple, object-oriented, distributed, interpreted, robust, secure, architecture neutral, portable, high-performance, multi threaded, and dynamic language.

The eleven buzzwords used in this description further explanation. So at this time let us take a few minutes to make sure these buzzwords are clear and understandable.

Simple

The first component of this description is Simple. Create a programming language that was easy and quick to learn. This would keep the number of language constructs small. A goal was to make the language look familiar to a majority programmers. The Java language is very similar to C and C++. In order to keep the language small there were many features available in C and C++ that were removed. Many of the features that were removed led to poor programming practices or were rarely used. The most important simplification that the Java language made was not providing pointer constructs. Because there are no structures, arrays, and strings are objects then there is no need for pointers. Pointer happen to be one of the most popular areas that programmer can produce errors. Additionally the Java language handles the referencing and dereferencing automatically. This way the programmer does not have to worry about what and how to reference or dereference data, unlike one who is required to have this knowledge when programming in C or C++.

Java also implements automatic garbage collection, so the programmer does not have to worry about memory management issues. The Java language is so simple, because it is also easy. What makes it so easy are the following three points.

Object-oriented

Java is an object-oriented language. Object-oriented languages are an entire paradigm shift. What this means is the programmer is focusing more on the data in the application and the how the methods manipulate that data rather then thinking of only procedures. The Object-oriented languages are very powerful in what they can do.

Because Java is an object-oriented language, like all other object-oriented languages it set the foundation for allowing reuse and inheritance of code in both a static and a dynamic fashion. In an object-oriented system, a class is a collection of data and methods that operate on that data. It is at this point where these two ideas come together. "Java comes with an extensive set of classes arranged in packages", that a user can make use of in their Java programs. Some examples of these packages are java.awt package (provides classes for creating graphical user interface components), java.io package (classes that handle the input and output), java.net package (classes that support network functionality), and java.lang package (the root of the Java class hierarchy).

Distributed

Java supports applications on a network. Because the Java language can run across a network, it makes itself a distributive language. The URL class permit Java to open up files on remote objects on the Internet. "Java also supports reliable stream network connections with the Socket class, so you can Create distributed clients and servers." (Flanagan 6).

.

Interpreted

The Java compiler generates byte code, which is a universal code, instead of machine code that is machine/ platform dependent. Java uses an interpreter to execute the compiled byte code, so Java is an interpreted language. As already eluded to the byte code provides an architecture neutral object file. "The code is designed to transport programs efficiently to multiple platforms." (Flanagan 6)

Robust

How reliable is the software you write with Java? Java takes care and eliminates many of the problematic programming errors. By eliminating these features the programmer is able to produce more reliable code. Many of these problematic errors develop when a programmer has to worry about how to manage memory. One of the sole methods to manage memory is through pointers. Java eliminated pointers, which result in the lost of most of the errors. Such errors as dereferencing memory, over-writing memory which in turn corrupts it. Similarly Java's automated garbage collector takes care of any of the possibilities of memory leakage or pernicious bugs related to dynamic memory allocation. In addition this garbage collector runs as a separate thread providing the ease and robustness of any type of memory management scheme without the extra full time overhead that normally comes with such memory management tools. Another feature that adds to the robustness of Java is it is very strongly typed language. This means there is extensive compile time checking. And Java required explicit method declaration, which is much more restrictive then the C language.

Secure

The security of ones system is extremely important when talking about Java. Java is meant to be used in a networking environment. Because the Java readily used the network to download Java applets, the owner would be concerned greatly on whether he was downloading virus' or other nasty programs such as Trojan horses. No one can claim there are one security holes in Java, however the developers can claim that numerous measures have been taken to prevent any such type of ill effect to ones system. The developers took the approach, do not trust anything. There was three methods that were taken to assist in security measures.

Java byte code first enters the Java interpreter, but before there is a chance for the byte code to run, the byte code is run through an the byte code verifier. Even though the Java compiler only make correct code, some one could try to tamper with the byte code between compile-time and run-time, be it intentional or unintentional. All the Java verifier does is check to see if it complies with the Java language.

Once the byte code passes the test by the Java verifier, the Java interpreter determines how the classes will be lay out in memory. "This means that hackers cannot imply anything about what the structure of a class might be on the hardware itself and then use that information to forge accesses. Additionally, the class loader places each class loaded from the network in its own memory area." (Ritchey 18) This way all network and local classes are stored in different locations and can not effect one another. The reason why the two areas do not effect one another is because of the robust feature we discussed earlier and about how memory is managed. And even then the Java interpreter's security continues to check to make sure the classes loaded do not access the file system accept for specified manners.

Architecture Neutral

As mentioned earlier, byte code is one of the major feature and advantages to the Java language. Java was designed to be a network-based application. It is important that Java be able to run across several different platforms. Because the Java compiler creates this byte code, the byte code, it can be sent to any platform and run on it as long as there is Java virtual machine setup on the machine. With the growing number of platforms that exists today, it is important that Java is completely portable..

Portable

Java, being architecture neutral is one huge reason why Java is portable. However, Java took it one step further, it ensured that there were no "implementation-dependent" aspects of the language specification. The Java environment itself is portable to new hardware platforms and operating systems. The Java compiler is written in Java and the run-time system is written in ANSI C. "The run-time system has a clean portability boundary that is essentially POSIX-compliant." (Flanagan 8)

High-performance

There exists a wide spectrum for high-performance concerning Java. Java is an interpreted language, so it will take a bit longer then it will for compiled or native code. When ever you are trying to place a programming language in this high-performance spectrum, there are factors that dictate where it falls within the spectrum, speed, reliability, and portability. The Java language falls in the middle of this spectrum. It is not as fast as native or C code, but it is very portable were C code is not. Java's speed is not the best, but there are a number of tricks that Java has implemented to improve the performance and speed of Java.

Just-in-time complication is one of the more unusual tricks. What the Java compiler does is produce byte code. However, this byte code is extremely close to machine code. Upon run time it has very like difficulty converting it into machine code unlike other programming languages like C and C++. Multi threading

Multi threading is simply being able to run multiple tasks at the same time. This is a difficult concept to coordinate. It is very difficult to accomplish this in other programming languages, because if on thread modifies a variable used by another thread, then a locking system has to be developed. Java is a multi threaded language. It has thread built into the language, which improved the performance of graphical applications. In most cases thread my waste time sitting idle. Java takes this idle time and does it management tasks, such as garbage collection. Not only does Java support threads, but there exists a built in Java type called synchronization. Java's thread support also supports synchronization.

Dynamic

The Java language was designed to adapt to an evolving environment; it is a dynamic language. For example, Java loads in classes as they are needed, even from across a network. Classes in Java also has a run-time representation. Unlike in C or C++, if your program is handed an object, it can find out what class it belongs to by checking the run-time type information. The run-time class definitions in Java make it possible to dynamically link classes into a running system. (Flanagan 9)


Villanova Univ. Seal Top of Paper | Previous Page | Next Page | Bottom of Paper

Written By Graham L. Mehl
Last Modified on April 23, 1996
© Villanova University
</