Mi Ni Pai

About Java

What it is

Java was designed to fulfill the "write once, run anywhere" dream of thousands of programmers. Before Java, you sat down to write a Macintosh program. Then you looked for ways to convert it to Windows. Then a new version of Windows came out, and you had to look for a way to convert it to run there, too. Before you knew it, you had dozens of versions of your programs and thousands of headaches that come with keeping it running on all of the varieties of printers, monitors, CPUs and the like that the computer industry spews out with gleeful abandon.

"In theory", Java has solved this problem. I designed and implemented Mi Ni Pai entirely on a Macintosh PowerPC 8500, using Symantec Café, yet Mi Ni Pai should run everywhere (and not just in the small worlds of Mac's and PC's, but also on all the flavors of Unix, as well as on computers that haven't even been designed yet).

In practice, there are still a lot of quirks to worry about, but no "show stoppers". I'll get to those later.

The way Java accomplishes this is very, very simple and should have been done a long time ago. No one really tried because there was no easy way (like the internet) to get it distributed properly so that it could work. Even now, with the internet, most of the problems have to do with distributing Java.

The reason that different programs have to be written for different types of comptuers and operating systems result from three key differences between computers; the "machine code" is different, the "operating system interfaces" are different, and the physical capabilities (such as the size of the monitor or the number of buttons on the mouse) are different.

Java uses a "virtual machine" to eliminate the differences between computers; a virtual computer within the real computer. The "virtual machine" is actually just a program which reads a compiled Java program as it runs and "translates" it into the current environment. To accomplish this, Sun had to make some arbitrary choices (such as ignoring some features, like the second mouse button, since not every computer has one). Most importantly, a "virtual machine" (called the Java Virtual Machine) must be written for every type of computer which will run Java. Of course, that only needs to be done once, rather than once for every single program ever used on more than one computer.

Most of the quirks arise from the fact that not every JVM is implemented in exactly the same way. In the course of developing Mi Ni Pai I used about 9 different JVM's on the Macintosh (first Symantec's own, since Apple's wasn't ready then, followed by about 4 versions of Apple's Macintosh Runtime Java, along with three versions of Microsoft's own Internet Explorer JVM and one version of Netscape Navigator's JVM). Part of the problem there is that Java is continually evolving and expanding, so between bug fixes and implementing new features, the JVM is constantly being updated. In addition, each browser supplies its own JVM as an option for people who don't have (or like) a JVM resident in their operating system.

Most of the differences occurred in the earlier (buggy) JVM's and have disappeared. The only major differences that I notice now are in performance and drawing behavior (for instance, the Microsoft IE 4.0 JVM draws the partially transparent shadows as completely black; it runs fast, but they got some of their speed by removing functionality).

Anyway, I owe a big thank you to Sun, both for creating a wonderful language (as compared to Basic, Cobol, PL/1, Pascal, C, C++, and the dozen other languages that I have used and forgotten as quickly as I could) and for creating an environment where I can use my talents to reach as many people as I can.

Java and the Web

Java provides a unique capability for the Internet because of its "portablity" (that is, because any Java program can run on any computer without changes). It allows programs to accompany web pages, with the near certainty that those programs will run correctly. A mortgage company can provide sophisticated mortgage calculators, informational pages can provide embedded Java search engines, car manufacturers can include programs which compute accurrate price estimates based on complex combinations of options and factors. And, of course, there are games, too...

Back to the Host Kit Main Page