Java: A platform for platforms
Sun's reorg may seem promising to shareholders but it's also a scramble for position. The question now is whether Sun can, or wants to, maintain its hold on Java technology. Especially with enterprise leaders like SpringSource and RedHat investing heavily in Java's future as a platform for platforms

Also see:

Discuss: Tim Bray on 'What Sun Should Do'

Newsletter sign-up
View all newsletters

Sign up for our technology specific newsletters.

Enterprise Java
Email Address:

Why we care about Java

Forces are at work to divide Java. The original and true purpose of the technology will carry Java through the current maelstrom of confusion and clutter

  • Digg
  • Reddit
  • SlashDot
  • Stumble
  • del.icio.us
  • Technorati
  • dzone
Arift has opened in the Java community because of arguments concerning Java's portability, efficiency, business politics, and even whether Java is a language or a platform. In this article, I address these concerns and remind you why we care about Java. Further, I illustrate how attempts to resist the "will of the Internet" have failed.



What is Java? A language? A platform?

Java is a programming language that comes with a well-defined set of APIs or class libraries; together the language and API form a consistent view of any platform. You can call Java a meta-platform or a view of an existing platform, but the effect remains the same -- Java supports the execution of a single program without modification on any machine with a Java-compatible VM and API. That is, Java gives you a homogeneous view of an inherently heterogeneous network.

Java became important primarily because it provides for the seamless and invisible distribution of software across the Net. Prior to Java, there was no Internet programming language. If another language had surfaced before Java with the key ingredient of portability, Java might not have been so successful. Consider Visual Basic, an extremely successful predecessor to Java. Visual Basic does not have the huge groundswell that the Java revolution has because it is neither portable, secure, nor designed with the Net in mind. Visual Basic is an example of the same old limited PC paradigm. Visual Basic runs on 80 percent or so of the World's computers, but apparently the community thinks that 80 percent is not sufficient for a revolution. Just as telephones are vastly more interesting and useful when everybody has access to one, being able to run a program anywhere is dramatically more significant than running it on only 80 percent of the machines.

Portable? It depends...

What about recent statistics showing that about half the Java programs do not run on all machines? These studies do not show that Java is not portable. They do, however, point out that programmers are not taking advantage of the mechanisms available in Java to write portable code. Just because you write in Java does not mean that your program is automatically perfectly acceptable to every platform. For example, the following Java code is not portable (in that it will not execute as the author intended) nor is the equivalent code in any language portable.

File f = new File("/usr/dict/words");

Obviously, file /usr/dict/words will not exist across all platforms and, further, the use of the backslash as a file separator is nonportable; consequently its presence renders the surrounding application nonportable. There are many analogous examples when building GUIs such as expecting specific font or screen sizes. Clearly, if you ask for an 800x600 window on a 640x480 screen, your program will fail. The 100% Pure Java Initiative is an attempt to get programmers to pay attention to portability (see the 100% Pure Java Cookbook). Java gives you the tools you need to make things portable, like GUI layout managers, Unicode, locales, and so on -- you do not have to rely on ad hoc solutions like C++ (e.g., di-glyphs and tri-glyphs for multi-byte character sets, system calls for locales).

  • Digg
  • Reddit
  • SlashDot
  • Stumble
  • del.icio.us
  • Technorati
  • dzone
Comment
Login
Forgot your account info?
Add comment
Anonymous comments subject to approval. Register here for member benefits.
Have a JavaWorld account? Log in here. Register now for a free account.
Resources