|
|||
|
Part I
|
Java | C | C++ | |
---|---|---|---|
Simple | J | K | L |
Object-oriented | J | L | K |
Robust | J | L | L |
Secure | J | L | L |
Interpreted | J | L | L |
Dynamic | J | L | L |
Portable | J | K | K |
Neutral | J | L | L |
Threads | J | L | L |
Garbage collection | J | L | L |
Exception | J | L | K |
J Fulfilled by the language | |||
K Not built in the language, but feasible | |||
L Not feasible in this language without third-party libraries |
First and foremost, Java is definitely object-oriented. It is somewhat similar to C++, but its programming supplants functional and procedural styles. Java programmers only manipulate objects, data members, accessors, and mutators. Extra features such as automatic garbage collection (a garbage collector keeps track of the object instances and frees them when no longer used), object references replacing arithmetic address pointers, and native or nonnative multithreading add to Javas simplicity and power.
Java is a true object-oriented programming language. It fully supports encapsulation, polymorphism, inheritance, and dynamic bindings. The main benefit for the programmer is that his or her programming model will be close to the real world objects, making them easier to implement. Software reuse also benefits from this orientation, as is the case, for example, with many well-known C++ libraries.
Java is architecture-neutral, portable, and robust in that it can run on various platforms, anywhere on a network, regardless of which graphic subsystem is in use. It is truly independent of hardware, operating systems, and GUIs. The design of the Java Virtual Machine and Javas Abstract Window Toolkit make it portable, much more portable than C or C++, greatly simplifying deployment issues. This is why Java has such presence on the Internet. While Java applications are stand-alone programs, applets are pieces of software that can be downloaded from the Internet or intranet and run inside a World Wide Web (WWW) browser like HotJava. Servlets are also pieces of software that run as extensions to WWW servers while aglets are software agents that live and persist in networks, moving from host to host to perform dedicated tasks.
Java is an interpreted language whose bytecodes run within a secure virtual machine that translates the bytecodes to native CPU instructions. In some cases, this bytecode is compiled just in time and cached, or even flash-compiled so no additional interpretation is needed. It is also very dynamic. Java application classes may be downloaded across networks automatically.
Before passing to the interpreter for execution, bytecodes are verified. Bytecode verification ensures that the code does not point where it cannot point, that it does not violate access and network restrictions, and that it correctly accesses objects. Security is a very important intranet and Internet issue, which is why it is addressed at many levels of the Java environment.
Java provides an exception mechanism to create and catch user program errors and to catch system errors. This mechanism is superior to the usual way of trapping errors using and testing return codes everywhere in the programs. It also adds to the codes simplicity and readability, which decreases the risk of introducing errors into programs.
Finally, Java features multithreading in a manner that is mostly independent of the underlying operating system from a programmers point-of-view. Threads allow client-server applications to perform multiple tasks, including animations, concurrently.
Many computer enthusiasts once said Java was well suited for animating World Wide Web pages. Actually, its use within WWW pages, mostly in the form of Java applets, is more a consequence of its design than its ultimate goal. Java is a very complete language, and there are no limitations that make it unsuitable for corporate and enterprisewide professional and business applications. On the other hand, both Sun and other parties are continuously enhancing the Java environment. These enhancements always preserve investments so there is no reason to wait before developing your next greatest corporate application in Java.
Previous | Table of Contents | Next |
|