Yanick's Guide to Web Authoring

Java

What is Java?

Java is an object oriented programing language, just like C++ (on which its syntax is heavily inspired). And despite the myth around it, it's not small, and it's not simple. I would say that its learning curve is more or less equal to C++'s (in fact it's a little easier to learn since it doesn't have these nightmare inducers that are also called pointers). And all that you can do with C++, you can do with Java. Including shooting you in the foot.

Java have two major traits that make it different from your average programming language.

Usually a program is either compiled one time into an executable (C, C++, Pascal, Modula-2 are languages that work this way), or interpreted each time it is executed (Visual Basic is an example, Perl is another. Take notes, kids, this is the only place you will see me talk of VB and Perl in the same breath). Having the program compiled into an executable have the big advantage that the said executable don't need the compilator or anything else to run. But an executable can only run on the arhcitecture it was compiled on. An UNIX program can't run on a PC, and vice versa. So if one wish to port his or her program to another architecture, one must compile the source code on this environement. An interpreter does the opposite. Each time the program is called, the interpreter read it and does the dirty work. So the user must have the interpreter to execute the program.

Java is stuck in the middle. When you compile it, it produces a .class file that is half-compiled. When someone want to run it, he must feed the .class to a "java virtual machine" on his computer, which finish to compile the program and run it. This way the same code can run on any architecture, as long as the user have the proper virtual machine. This is of course a capital property when you want a program to run on the heterogenous network that is the Net. The bad news is that this on-the-fly compilation produces a huge overhead. Java programs are slow, far more slower than C++ programs (they can be 10 times slower. Or that's I saw last time I checked, the speed gap can have reduced since then). This difference depends of the quality of the code produced by the virtual machine, though, and many people are working their tails off to improve Java's performances.

As I said, Java is a programmation language like any other. It can produce programs (also called applications) that you can execute like any other programs. But Netscape and Internet Explorer (and other browsers) also give us the possibility of inserting small applications (applets) in a web page. Let me shatter a myth about applets. Even if they are called such, there's no size limit on an applet size. It can be small or huge. The only limit is the downloading time that it takes (a visitor will simply not wait 6 hours to see a 20 megs applet).

And since we have begun to shatter illusions, let continue. There's no fundamental reason why Java is the language of the Net rather than, let say, C++. Of course, the virtual machine gimmick makes things easy, but people could make the same thing with any other language. So we will maybe have in a not-so-distant future the possibility to also insert C, Pascal or Cobol programs in a web document.


[ Yanick's Guide to Web Authoring ]
Yanick Champoux