Is this another rant?….Yes. I apologize for all the rants lately, but hopefully there is some educational value woven throughout my posts, and besides I promised this one.
Lets start with a history lesson…
In the beginning there was assembly, the language that changed with each machine architecture. The machines ran quick and required little resources, but the programs were error prone and took a lot of effort to develop.
Then came the Titans; FORTRAN, COBOL, and LISP, the ancestors of all modern programming languages. We learned a lot from these Titans but just as the gods of olympus had to dethrown the titans, so too did the gods of the programming languages. These gods I speak of are C, Java and Smalltalk.
All these languages have something in common, they were all developed to serve a specific need. We might even say each language tackled a specific domain of programming. FORTRAN was built to do scientific and mathematical computations, COBOL was created to do business applications, and LISP was created to do lambda calculus but turned out to be great for AI programming.
Notice I haven’t mentioned the implementations of these languages. That is completely intentional, the language itself does not rely on, or developed around the implementation. In the olden days there was two different ways of running an application. First you could compile the source code for your machine architecture and run it. Second you could install an interpreter on your machine and have that translate the program on the fly. Ultimately the language does not dictate this, although typically one type of implementation exists for each language (e.g. c is compiled, LISP is interpreted).
Lets take this thought process a little further. If the language and the implementation are separate then what affects performance? That is right…the implementation. If you want a really really really fast application you should compile it for the specific machine it needs to run on. If you want a highly distributable program you will want to use an interpreted language. If you want the best of both worlds you want a hybrid, which is compiled into a intermediate language (e.g. Java bytecode, Microsoft’s Common Intermediate Language “CIL”). Java and C# both happen to fall into this realm, but what does that really mean? To me it means there are two languages at work here, Java and Java bytecode. Java is a high level language that is compiled into a lower level language Java bytecde, that is interpreted. Two programs are required to make this work, the first is the Java compiler and the second is the Java bytecode interpreter.
If you think about it this way it should be easy to see that Java is not the great technology that Sun has provided for us. Java bytecode is the great platform that Sun has provided for us and Java is just the first language to compile into that bytecode. Interesting enough Microsoft seems to be the one who stumbled upon the power of the intermediate language as they originally created compilers for C# and VB.NET, but not until recently did they release a tool kit, DLR, that truly allows multiple languages to run on CIL.
That brings me to my point. Java is not the JVM! Java is just any other language, if someone wanted to they could write a compiler that took C# and compiled it into Java bytecode, JAVA doesn’t MATTER! All the Java Servers, and JVMs run bytecode and if you can get to bytecode you get all the benefits of Java. The one advantage Java has over certain other languages that are implemented on the JVM is type safety. And the Java community doesn’t even seem to be embracing that except for a reason to claim they are better than JRuby.
If there is anything I want you, the reader, to get out of this it is to remember/realize that Java is no different than Actionscript, C#, Ruby, or VB. They are all just languages, the implementation of that language is what determines performance and deployability. For a perfect example look at Ruby, ruby is interpreted using MRI, it can be a hybrid using JRuby, Rubinius or Ruby 1.9 which all use virtual machines like the JVM. The real power in the Java community is it’s runtime the JVM and fortunately Sun realized this and is encouraging the development of new languages on the JVM like Scala, JRuby, Groovy and JYthon. I am very excited about these possibilities because it means all the work in creating an efficient server will be transfered to these great dynamic languages, thus combing the benefits and safety of a mature server environment with the power and possibilities of a dynamic language.
If there was one other thing I want you to get out of this rant it is that the JVM is to operating systems what C was to hardware. C could be compiled into assembly for many different machine architectures, just like Java can be compiled and executed on many operating systems. The JVM just so happens to be a better abstraction than C did, because they added the benefit that you don’t have to recompile your code for every OS. Regardless of this added benefit it does the same thing. You write your code once and it runs in multiple OSs, just like with C you wrote your code once, and compiled it for many hardware architectures.
There it is one more rant under the belt. I have a few more things I need to get off my chest, but I also have some real content coming soon. I just updated my first screencast to a video sharing service. As soon as it is approved and I can verify the quality is to the point I want it at, I will post it here.