Monday, June 23, 2008

Great tools: the Java advantage

Last February, I wrote a AI blog article on a very simple Ruby library to parse some relationship values returned by the Open Calais web service. I wanted the same functionality today in a Java program. I was surprised that the number of lines of code required was the same - strange since Ruby is a much more concise language than Java.

The trick was that I was able to point my NetBeans IDE at the WSDL file for the Open Calais web service, and the work of calling the web service was essentially done. The Java code for parsing what I wanted out of the returned result was a little longer than the Ruby code, so the two programs ended up being the same length.

Another example of a time saver for Java vs. dynamic languages like Ruby, Python, and Lisp: using a Java IDE (like NetBeans) to generate unit test stubs from any application class - not so good for test first development, but I don't do that: I like to make a first cut at implementing classes, then add unit tests. While the Domain Specific Language (DSL) Ruby on Rails does generate test stubs, they are not as complete or useful as what NetBeans generates for me.

Lastly, because Java is a statically typed language, Java IDEs still do a better job at refactoring, code completion, etc. than environments for dynamic languages although Emacs based Lisp development tools and the Ruby NetBeans tools are very good.