Gosling on JVM Scripting

11 AM February 2, 2005

I went along today to hear James Gosling talk. For me, the most interesting question was on scripting languages.

James said that Sun won’t support any one of the scripting languages over the others because, “If we say Groovy is it, the Jython guys will come after us with knives.”1

So it looks like Sun are sitting back, waiting to see if any scripting language will become popular enough to be worth supporting, which is probably the wise thing to do at the moment.

The big two JVM scripting languages are Jython, an implementation of Python for the JVM, and Groovy, a completely new, JVM specific language.

Jython is mature and usable, but it’s development was on hiatus until recently. Jython’s only real problem is that it naturally appeals to only a small audience: programmers that know both Java and Python. Since Jython doesn’t have a Java-like syntax, Java programmers tend to dismiss it, and CPython programmers tend to avoid Jython because they need to learn Java and the Java libraries to get the benefit of running on the JVM. All that said, more and more Java developers are learning Python as Python’s industry mindshare grows. There is a chance that enough people will get excited about Python on the JVM to grow Jython into something big.

Groovy, on the other hand, is specifically aimed at Java developers, but it is not yet mature enough to use in most real-world situtations. Groovy has quite a number of challenges ahead, including defining the language and managing public expectations about the status of development. I think Groovy has a good chance of delivering a production quality implementation in the next 12 months. If they do, and the IDE vendors introduce Groovy support, then there is every chance that Groovy will be making its way into enterprises in the later half of 2006.

Personally, I hope both Groovy and Jython go on slug it out for developer mindshare over the next few years, but if I had to pick one over the other, I’d pick Groovy.

1 In truth, I can’t remember if it was “knives” or “an axe”. Gosling mentioned both kinds of weapons at different times. Anyway his point is well taken – those Jython advocates are dangerous :)

By alang | # | Comments (19)
(Posted to javablogs, Software Development, Python and Java)

Comments

At 15:00, 02 Feb 2005 Josh Allen wrote:

Python's main benefit as a scripting language comes exactly because it is so different from Java. Any scripting language that resembels the wordy world of Java is the wrong solution. I think of having to use Bean Shell for macros in JEdit and cringe.

I pity any Java developer that would dismiss any language simply because it's not like Java.. such closed mindedness would hopefully lead them to a stagnated carreer where our coding paths would never meet. If Sun picks Jython then they already have a working implementation and language definition to go with, and the community can use it's resources to improve that, instead of being split and ultimately half wasted.

(#)
At 15:54, 02 Feb 2005 Brian Slesinsky wrote:

You left out JavaScript. Lots of HTML jockeys know it already and it's superficially similar to Java, so some folks find it appealing. Ant can also be used as a (rather awkward) scripting language.

But I think the primary competition for Jython is really Java. With a good Java IDE, it's easier to write a Java method that does something script-like than to learn a new language. It's not like the old days when scripting languages were far easier than C.

(#)
At 16:03, 02 Feb 2005 j. betancourt wrote:

You also left out BeanShell.

I think it may be the most mature of the JVM scripting languages.

Also, since it follows Java syntax and adds scripting extentions, seems more 'usable'.

(#)
At 17:31, 02 Feb 2005 M. Easter wrote:

re: "easier to write Java method in IDE". Scripting languages are wonderful for testing and analyzing output. Admittedly there is a mild learning curve with Jython, but I would take Jython over Java every time for quick utilities. File IO and string processing is hardly "convenient" in Java, even in an IDE.

What happened to the days where people were proud of the number of languages they knew? I have not used Groovy but in general I don't need my scripting language to look like Java syntax.

I don't know if Jython can overcome competitors such as Groovy, JRuby, Beanshell, but IMHO Python and Java are a potent combination.

M.

ps. Thanks very much for the blog. I'm heartened to hear that the battle isn't over!

(#)
At 19:58, 02 Feb 2005 hohonuuli wrote:

"Jython’s only real problem is that it naturally appeals to only a small audience: programmers that know both Java and Python."

My personal opinion is that every programmer needs to know a scripting language. If a programmer only know Java, well, I wouldn't hire him for my team.

In my opinion, there are 2 big reasons that Python/Jython is far more useful for developers than Groovy: 1) Python and Jython are being used to support production quality applications. Groovy hasn't yet stabilized as a language and it's not clear what the final language will look like. 2) Learning python opens the door to java developers to write non-java applications.

(#)
At 02:43, 03 Feb 2005 Patrick Niemeyer wrote:

Mr. Gosling might not be aware of it, but Sun has clearly decided to back Groovy for some political reason. My submission for a BeanShell BOF at last year's JavaOne was rejected, but Groovy (a nine month old language at that point) was given a full session. BeanShell is a mature, fully Java compatible scripting language with a large user base. I'm all for letting a thousand flowers bloom and I'm not much for politics. But this year I think we are going to make a much bigger push to make people aware of the BeanShell language and to get input on features for the next release.

(#)
At 08:54, 03 Feb 2005 Jonathan Aquino wrote:

Why Groovy? One word: closures. Plus the syntax is so beautiful -- I can't put my finger on it exactly, but whenever I write a Groovy script I often catch myself thinking, "Hey, clever!" or "They improved on Ruby a little there".

The brutal thing about Groovy is what James has himself termed "debugging hell" -- Groovy error messages often give no information (or worse, misinformation) about why an error occurs e.g. NullPointerException, no line number given.

Lets not forget another great Java scripting language: JRuby. True, development has slowed, but it is still very useable (especially for processing text -- love the native regex handling).

(#)
At 08:54, 03 Feb 2005 Jonathan Aquino wrote:

Why Groovy? One word: closures. Plus the syntax is so beautiful -- I can't put my finger on it exactly, but whenever I write a Groovy script I often catch myself thinking, "Hey, clever!" or "They improved on Ruby a little there".

The brutal thing about Groovy is what James has himself termed "debugging hell" -- Groovy error messages often give no information (or worse, misinformation) about why an error occurs e.g. NullPointerException, no line number given.

Lets not forget another great Java scripting language: JRuby. True, development has slowed, but it is still very useable (especially for processing text -- love the native regex handling).

(#)
At 12:36, 03 Feb 2005 Laurent Joigny wrote:

I agree with previous post on BeanShell.

In java scripting languages, it is always about Groovy or Jython but I think that BeanShell is a excellent and mature alternative.

I am a Java and Python programmer so I do prefere Jython over Groovy but for java scripting purpose BeanShell is much more intuitive and usable.

Cheers

(#)
At 21:30, 03 Feb 2005 Greg Wilson wrote:

Jonathan Aquino said, "[Groovy's] syntax is so beautifu". I wish that were the case --- it has as many howevers, excepts, and gotchas as Perl's. (Is whitespace significant? Well, yes, sometimes...) Students of mine who tried it last summer (while I was on the JSR) found it pretty much unusable. I'm sure people could get used to its quirks (Perl is popular), but why bother? BeanShell, Jython, or JavaScript are already there...

Greg

(#)
At 17:51, 05 Feb 2005 Juancarlo Añez wrote:

Nice (http://nice.sourceforge.net/) is a programming language for the JVM on the Groovy spirit, but much more mature and with more desireable features.

The author says that he'll wait until version 1.0 (currently at 0.9.9) to publicize the language. Maybe that's why sucn a "nice" language gets mentiones so little.

(#)
At 19:24, 05 Feb 2005 namekuseijin wrote:

am i the only happy citizen to get to grips with the mature JVM Scheme interpreter implementation - kawa?

too bad. why bother with syntax when you don't need much of it?

(#)
At 07:56, 09 Feb 2005 John Zoetebier wrote:

I immediately fell in love with Groovy :)
The learning curve for Java programmers is very low. The last thing you want for programmers is to spend lots of time learning the peculiars of yet an other programming language. Groovy is actually Java++ : Java plus a lot of nice enhancemens which can use whenever it suits you. The concept of a closure is a natural extension to the Java language. It is actually so good that one day it may become part of Java itself.

(#)
At 19:02, 09 Feb 2005 Don Hagan wrote:

I believe Sun is missing an opportunity with respect to a scripting language or a tool to compete with Access, Visual Basic, Visual FoxPro, and other easy to use tools. These tools, especially VFP, have several of the charateristics of a scripting language. I don't think Java Studio Creator is a good solution.

Philosophically, I like Java and spent time reading books, writing some programs, etc. However, in the end I decided that Java was too complex, cumbersome, and had too many ways errors can be made in comparison to other tools. For simple to moderately complex projects, it just wasn't cost effective in my view.

Sun can compete very well with MS in the enterprise market. For other levels, it really can't compete very well with MS. A scipting language with a visual form and report designer and an easy redistribution capability would provide competition in this market.

(#)
At 14:55, 15 Feb 2005 Bob wrote:

Oh no, Sun is not playing politics. Yet BeanShell, the most Java like and mature hardly gets a mention. Groovy is a kludge and it shows. Jython is good but stagnant at the moment and you have all the Python baggage as well (it has to keep up with two different languages). BeanShell is it.

(#)
At 08:59, 20 Feb 2005 Jonathan Aquino wrote:

Here's an example I like that shows the wonderful conciseness of Groovy syntax:

Java:

  Map personToTypeMap = new HashSet();
  personToTypeMap.put("Fred", "ISTJ");
  personToTypeMap.put("Mary", "ENFP");
  personToTypeMap.put("Bob", "INTJ");
  for (Iterator i = personToTypeMap.keySet(); i.hasNext(); ) {
    String person = (String) i.next();
    System.out.println(person + " is type " + personToTypeMap.get(person);
  }

Groovy:

  ["Fred":"ISTJ", "Mary":"ENFP", "Bob":"INTJ"].each { person, type |
    print(person + " is type " + type)
  }
(#)
At 14:12, 23 Feb 2005 Eelco wrote:

I used Groovy for my current project. Though I initially, I was quite enthousiastic, problems stacked up pretty soon. It's definitively not ready for production imo. Anyway, I replaced Groovy with PNuts, and I am amazed how good PNuts is for a library with so little attention.

http://jroller.com/page/Eelco12/20050219

(#)
At 04:10, 28 Mar 2006 kp wrote:

I have been using groovy for quite a while now and I'm very happy with it. It's still maturing, but steadily so.

The notion that it's too java-like really needs a second thought. It is more like ruby or smalltalk (or ML) at heart that java, in some ways. It also has the advantage of being able to work seamlessly with existing java classes, which is a key benefit.

I also have used JRuby and Jython a bit. I love Ruby - always have - but JRuby on Java shows the seams a bit too much for my taste.

Each time this topic comes up, groovy is referred to by many who are rehashing something somebody said a year ago. A lot has changed. Programming languages mature slowly - don't count groovy out.

Not only is it troubling that it would seem relevant to somebody that bruce tate was overheard to say 'it doesn't use a parser' sometime last year, but that's just simply not true. It has for some time now had a formal grammar and a recognizer built with antlr.

Interesting: I talked to bruce tate about ruby two summers ago at a NFJS conference and he thought I was from Mars. Look at him now. ;-)

Groovy has come a long way. Languages mature slowly. I think groovy not only has potential to be good language, but it is also very useful right now.

The error messages have also been steadily improved as well.

(#)
At 20:40, 13 Jun 2006 UL wrote:

Jython:

for person, ty in {"Fred":"ISTJ", "Mary":"ENFP", "Bob":"INTJ"}.items():
    print person, "is type", ty

Or just:

for person, ty in ("Fred","ISTJ"), ("Mary","ENFP"), ("Bob","INTJ"):
    print person, "is type", ty
(#)

Add Comment




(Not displayed)






(Leave blank line between paragraphs. URLs converted to links. HTML stripped. Indented source code will be formatted with <pre> tags.)




© 2003-2006 Alan Green