Sunday, May 22, 2022

Portable machine code

The Java virtual machine (JVM) pioneered the idea of write once run anywhere programs. Once a program has been compiled into JVM bytecode once it should be runnable across platforms. With the security manager, the Java platform allowed portable programs to be run in a secure sandbox. The combination of portability and security led to Java applets, which were a defining part of the early web.

The idea of a universal portable machine code format was pioneered by Sun Microsystems with the Java virtual machine (JVM). The basic point of the Java project was to a create language for a universal platform that can be run on any device or operating system. The point of the JVM is to be the platform that enables this. With revolutionary advancements in portability and security, the Java platform sought to reinvent computing.

The Java platform was more then just an idealistic project to reinvent computing, it was a major engineering effort. The JVM was accompanied by an extensive class library and the most advanced optimisations possible to make running Java code efficient. The combined engineering efforts of the developers at Sun microsystems is what made these ideals into a reality.

Of course, the project to create a portable machine code format didn't go over too well with everyone. Microsoft wasn't too happy about it. The problem was that a portable machine code format like JVM bytecode would mean that Java software could be used on other platforms not controlled by them. The idea of a portable machine code format was new at the time so they didn't know how to react.

The portability idea of Java was embodied in the 1995 slogan "write once, run anywhere" of Sun Microsystems. Its important to note that it is not simply portability that defined the Java platform, but the bytecode format. Other languages might provide portability with a text-based format, but Java provided it with a bytecode format and assembly language. The JVM is a portable bytecode format.

This portable bytecode format, for a long time, was run in web browsers as Java applets. But it was not to last, as Java applets came to an end. Sun's vision of a write once, run anywhere portable binary format was too ahead of its time. The idea of a portable machine code format is still an ideal worth striving towards. That is where WebAssembly enters into the scene.

WebAssembly is not an innovative or revolutionary new technology. By moving to create a portable machine code format, WebAssembly is treading on very old ground. But perhaps by creating a portable machine code format, WebAssembly can revive Sun's great ideal of a "write once, run anywhere" binary format and what was achievable by Java applets.

At this point, we should ask what the point of the web is. Is it to create a rich text format, with a little bit of interactivity and animation or is it to create a thin client to run applications on? If it is the later, there is no reason that HTML is necessary. A web like platform could be constructed with JavaFX and FXML, by adding hyperlinks to FXML and opening up JavaFX applications in a secure sandbox. In an alternative reality, that could be how the web evolved.

External links:
Oracle Java

No comments:

Post a Comment