Personal Information Portal - a.k.a Blog
May 30, 2000
by Sergey Kucherov
Is Java the programming language of the future? Can we expect all other programming languages to step back and occupy some small niches leaving mainstream of application software development to Java? Hardly. From the other hand Java provides computer industry with unique chance to forget the platform war. By establishing platform-independent and object-oriented standards for creating software applications Java pushing computer industry to new technological level.
Not everybody will agree with such determination of Java. For example, creator of C++ programming language Bjarne Stroustrup does not consider Java as a platform-independent at all:
"Java isn't platform independent; it is a platform. Like Windows, it is a proprietary commercial platform. That is, you can write programs for Windows/Intel or Java/JVM, and in each case you are writing code for a platform owned by a single corporation and tweaked for the commercial benefit of that corporation. It has been pointed out that you can write programs in any language for the JVM and associated operating systems facilities. However, the JVM, etc., are heavily biased in favor of Java. It is nowhere near being a general reasonably language-neutral VM/OS."
Bjarne is not too far from the truth. Java is a platform. The new platform which finally able to hide difference between different platforms and establish common object-oriented standards for development of software applications. Java platform is oriented to structure of Java language, but unless other above-platform virtual machines appear, there is no other candidate anyway.
Why computer industry needs an above-platform standard? Because it fails to establish a platform standard. Most of modern software development technologies is still only one floor above machine-level code. Variety of platforms does not facilitate competition but keeps software development technologies on the second floor. By establishing virtual machine standards Java provides developers with opportunity to simplify development process by rising software development technologies on a new level.
This does not sounds very good, especially for people who do not like Java language. Not to worry. There are two "Javas" -- programming language and virtual machine (JVM). Because JVM defines standards for program byte-code one became new platform and provides opportunity for all programming languages to demonstrate their power and flexibility. You do not need to write Java code to create Java programs.
Java compiler generates byte-code. Unlike machine code generated by traditional compilers, the byte-code cannot be executed by a processor. To execute byte-code you have to run special program - Java Virtual Machine. This program will read byte-code from file and just follow the instructions. JVM will execute Java byte-code much slower than if a processor will run native machine code. However, there is good side of it. You can execute very same Java byte-code on any computer where exists JVM.
Java byte-code is similar to assembler language. It is why it is not too hard to create JVM for a specific platform. For example the following Java function:
int addTwo(int i, int j) {
return i + j;
}
will be translated by Java compiler to the following byte-code:
iload_1 // Push value of local variable 1 (i) iload_2 // Push value of local variable 2 (j) iadd // Add; leave int result on operand stack ireturn // Return int result
Here you see a mnemonic description of Java byte-code. The same way the assembler language enables to display mnemonic code instead of real machine instructions. You can learn more about JVM commands by reading "Inside The Java Virtual Machine" (2).
Is it absolutely necessary to create Java byte code by compiling Java source code? I do not see any problems in translating the following Pascal code to the byte-code from previous example:
function addTwo(i,j: integer): integer; begin result := i + j; end;
You can develop a compiler, which will compile a non-Java program to the Java byte-code. Because SUN Microsystems developed Java specifications along with Java language some critical limitations appears for other programming languages.
First of all Java is object-oriented language. It is possible to compile a non-object-oriented code to Java. However, it will be much easier to deal with language which not only support predefined classes but also able to create new one. Because of that it will be quite complicated to create Java compiler for such languages like COBOL, BASIC, or C.
Java also is a package-oriented language. It will be much easier to create Java packages from a package developed in such language like Pascal, Modula, or ADA.
So far, there are not too many compilers to generate Java byte-code from non-Java source code. Inprise has demonstrated a limited facility to compile a subset of Pascal to run on the JVM during development of Delphi 5. According to Chuck Jazdzewski, it was not functional enough to deliver on what Inprise feel customers expecting.
However, at least one project already succeeded in this field. Mill Hill & Canterbury Corporation has completed the development of the Pascal to Java compiler. There also Delphi2Java project. Instead of compile Delphi programs to Java byte-code they convert Delphi projects to Java source code. The Visual Basic version is also available.
SUN Microsystems actively pushing Java to the "next floor" by expanding concept of Enterprise Java Beans. It is only first steps toward simplification of distributed computing development. Now you can find number of devices with embedded JVM. Very soon we may witness JVM on a Chip. It is very logical to expect appearing more and more development tools not only producing Java byte-code without compiling Java source code but realizing some new development concept.
[1]
Bjarne Stroustrup.
The Design and Evolution of C ++.
Addison Wesley Longman, Inc. 1994. ISBN: 0201543303
(*)
[2]
Bill Venners.
Inside The Java Virtual Machine, 2nd Edition
McGraw-Hill Professional Publishing. 1999. ISBN: 0071350934
(*)
[3]
Joshua Engel.
Programming for the Java(TM) Virtual Machine
Addison-Wesley Pub Co. 1999. ISBN: 0201309726
(*)
[4]
Alan Vermeulen, Scott W. Ambler, Greg Bumgardner, Eldon Metz, Trevor Misfeldt, Jim Shur, Patrick Thompson.
The Elements of Java Style
Cambridge University Press. 2000. ISBN: 0521777682
(*)
[5]
Michael C. Daconta, Eric Monk, J. Paul Keller, Keith Bohnenberger.
Java Pitfalls: Time-Saving Solutions and Workarounds to Improve Programs
John Wiley & Sons. 2000. ISBN: 0471361747
(*)