Talk:The Computer Revolution/Programming/Programming Languages Used Today

Write Once, Run Anywhere is *NOT* a "feature of the Java Language". That ugly fiction was developed by the Sun Marketing Department, and used to dupe people into believing that Java was somehow special in this regard.


 * Every** language is Write Once, Run Anywhere -- once the compiler/interpreter and run time libraries are correctly ported to a target system. Java is no better than other languages in this regard: in fact, due to the language design, it's actually worse in many ways.

Java is a complicated language: all attempts to write an efficient, optimized native code compiler for it failed so badly that Sun/Oracle eventually gave up, and defined the Java language in terms of the behaviour of a Java Virtual Machine(JVM). Because the way Sun defines the language, a developer may *NOT* implement a subset of the Java Virtual Machine, and still call the language that it runs "Java". Such a programmer is required to implement all of the "core features" of the Java language (such as multi-threading, graphics libraries, etc.) even if none of the programs that needed to run on the system will ever use those features.

As a consequence, BASIC remains a better example of "Write Once: Run Anywhere" than Java, because a BASIC interpreter is easy to implement, and fits in 64KB of RAM with room to spare: whereas the 60,000KB of "core libraries" that a Java Runtime Environment is required to support won't fit.

When Sun tried to run Java on cell phones, they couldn't do it without modifying Java itself. They were forced to define a special, stripped down version of the Java language, called J2ME. That's the opposite of "Run Anywhere". Sun/Oracle ships with a legal disclaimer that states that Java may not be used in life critical systems; a job that a language like Ada is often used for. It won't run on smaller systems, where other languages can. Oracle doesn't even offer a Java Virtual Machine that can run without an operating system.

All marketing hype aside, Java may be the worst examplar of "Write Once, Run Anywhere" than the best.