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.

Comments

  1. Hi Mark,

    I was wondering if you ever had time, if you could write a post on recommendations to newcomers of AI. Or advice which you would give to someone new. Programming Language recommendations, books, anything. Or even pointers as to where to look or how to start without wasting lots of time. I wonder, what is the popular language for AI development nowadays (academically and commercially)? Is it Java? Does anyone still use lisp, or has it fallen out of fashion in contemporary work? Is it worth investing in scripting languages for AI development?

    Thanks, I really enjoy your blog.

    ReplyDelete
  2. Hello Eric,

    I wrote about this 2 years ago (I just noticed that you commented on this at the time):

    http://markwatson.com/aiblog/2006/10/software-environments-for-working-on-ai.html

    I still think that it is best to choose one AI language and stick with it. It is true that I tend to switch between Common Lisp, Scheme, Java, and Ruby a lot - however, I have invested a lot of time on learning all of these languages, so I switching is not too big of a nuisance.

    I often choose a language based on the availability of good libraries for whatever application that I am working on.

    Best regards,
    Mark

    ReplyDelete
  3. Eric: re: using scripting languages: I believe that Google uses Python a lot, and some of that is AI development. One good reason to use Python is that the best AI programming book ("Artificial Intelligence: A Modern Approach") has the best support for Python for implementations of the examples in the book. That said, I use Ruby over Python because I like the language a little better.

    re: Lisp: a niche language, for sure, but still popular enough. I am using Franz Lisp and AllegroGraph for one of my own projects (that I hope ends up as a commercial product).

    ReplyDelete
  4. Eric,

    A book that Mark posted about and I enjoyed was _Programming Collective Intelligence_. If your interests are applications of AI to the Web and recommendation engines, this is a good book. The examples are in Python, but people have translated them into other languages (including Lisp).

    ReplyDelete
  5. What would be the best language for a human interactive and learning AI? One that is kind of like an artificial mind?

    ReplyDelete
  6. Hello Laurence,

    I am tempted to say Common Lisp or Scheme since they have (mostly) been my languages of choice for research programming for over 20 years.

    And, almost by definition, AI programming is research programming :-)

    However, in the last several years, I have been using scripting languages (Ruby s my favorite) for a lot of my work and research.

    For something different, I can recommend Prolog. Learning Prolog will stretch your brain in some pleasant directions :-)

    The language that I am learning now is Haskell (except that I am so busy writing my new book, that my learning time is really limited right now).

    -Mark

    ReplyDelete

Post a Comment

Popular posts from this blog

Ruby Sinatra web apps with background work threads

My Dad's work with Robert Oppenheimer and Edward Teller

Time and Attention Fragmentation in Our Digital Lives