Friday, April 28, 2006

Three Languages For Java Programmers

THURSDAY APRIL 27, 2006
Three Languages For Java Programmers
Dave Thomas, among others, has been saying for years that you can become a better Java programmer by getting out there and learning some other programming languages. The idea is that by knowing something about what the other guys are thinking you can think a little clearer yourself. I'd like to suggest three languages that I think every Java programmer should spend some time thinking about. Just to make it interesting, I'm going to describe each language first, before I tell you what it is. Here goes.
Behind Door Number One
Language number one is one of those dynamically typed, semicolon-less languages that have been all the rage lately. Programs written in this fully object oriented language tend to be much shorter than the equivalent Java. And you don't compile programs in this language, you just run the things. Like a lot of these dynamic languages, this one supports first class methods: You can pass a method, still bound to its original object, around as an object itself.
Language one also boasts some of those little features that are missing from Java. Operator overloading. A hash map object that is built right into the language. Default values for arguments.
My first language also has excellent XML support, a GUI that runs on all major platforms, as well as complete support for web services. It has all of these things because it is fully integrated into the Java VM. Anything Java can call, Jython, the language behind door number one, can call. Jython is so useful for building tests, for pulling quick Swing GUIs together, for trying out new Java API's interactively, that I am clueless as to why so few people use it or even know about it.
Behind Door Number Two
My second language is another one of those very high level things. Compared to language two, Jython is sort of a mainstream language. You can build objected oriented code with this language, but with a twist. Language two has a prototype based object model, which means you don't define a class, you define a prototype for your objects, a sort of master object to which all others of that 'class' link back to.
If anything, language two is more of a functional programming language than Jython. With the first class functions available in this language you can write whole programs that consist of nothing but functions which take functions as arguments and generate new functions as return values.
On the more pedestrian side, language two has a good regular expression library, networking support and is the subject of any number of easily available books. Give up? It's JavaScript. JavaScript is a real language! Yes there are umpteen million versions of it in the different browsers. Yes, it is easy to find layer upon layer of hacked up JavaScript out there. But it is a real language, and with the popularity of AJAX, we should probably spend some time figuring out what it is all about.
Behind Door Number Three
Behind our last door is a language what is emphatically not very high level. It is statically typed, object oriented, and very low level. There are objects and the objects have methods, but the methods are bizarre. Methods in this language lack both parameters and local variables in the usual sense. Instead, each method has a single, fixed sized array of values. When the method gets called, the parameter values are pushed into the first few slots of the array. The method can use the remaining slots to store local variables.
Along with the fixed size array, there is a stack. To do any kind of calculation on a parameter or a local variable, you need to push the value from the array onto the stack, operate on it, and pop it back onto the array.
Now here is the punch line: language number three is also totally integrated into the Java platform. In fact, it is the Java platform. Behind the third door we have Java bytecodes, the assembly language of the JVM. Back in the days of C and C++ there always seemed to be someone on every development team who knew the assembly language for the target machine. This person usually stood out as the engineer who had a unique perspective on the system. Well the JVM is our platform now and Java bytecodes are our assembly language. But most Java development teams have approximately zero developers who understand bytecodes. Perhaps you could be that person on your team.
Dave Thomas is right, we should go out and learn other programming languages. But we also need to have a better understanding of our own technical ecosystem, of languages like Jython which can extend the reach of Java, of JavaScript which, like it or not, we use all the time, and of Java bytecodes, the basis of every Java program.
Russ Olsen
Posted by rolsen ( Apr 27 2006, 07:38:31 AM EDT ) Permalink Comments [12]
     
Source: http://www.jroller.com/page/rolsen?entry=three_languages_for_java_programmers"

0 comments:

Popular Posts

Recent Posts

Text Widget

Powered by Blogger.

Theme Support

Pages

Ordered List

Unordered List

Find Us On Facebook

Recent Posts

Flickr Images

Video Of Day

Popular Posts