ITeye博客

Groovy, JRuby, Jython, Scala:谁是胜利者?

Eastsun · 2008-05-13 00:04 · 编程技术 · 非技术 · Markdown

原文地址:Groovy, JRuby, Jython, Scala: Who Wins the Script Bowl?

  简介: 这是一场关于脚本语言的“擂台赛”(严格说,Scala应该不属于脚本语言), Guillaume LaForge代表Groovy,Charles Nutter代表JRuby,Frank Wierzbicki代表Jython以及Jorge Ortiz代表Scala。他们展开了三轮的竞赛,每次比赛他们都需要展示一个Demo,然后有三分钟的时间向观众解说这个Demo,而观众可以通过短信对比赛进行投票。   这三轮比赛包括一个桌面应用,一个Web应用,以及一个自由发挥的项目用来展示各个脚步语言最擅长的东东。擂台赛的最后结果是:JRuby获得了第一,Groovy其次,然后是Scala与Jython。 A=Groovy, B=JRuby, C=Jython, D=Scala

Wednesday's [url=http://weblogs.java.net/blog/rags/archive/scriptbowlresults.jpg/voting.]Script Bowl [/url]was indeed what the caption promised, a rapid-fire comparison of scripting languages. Four developers took on the challenge to convince the audience of their language of choice -- in only three minutes per round. Guillaume LaForge represented Groovy, Charles Nutter represented JRuby, Frank Wierzbicki represented Jython, and Jorge Ortiz represented Scala.

All four languages compile to Java bytecode, but what distinguishes them? The jury, made up of Roberto Chinnici, Carol McDonald, and Ola Bini, made the four contestants compete in three categories: Each developer had prepared three demos, a desktop application, a web application, and one free-form app that shows off what the particular scripting language does best. After each round, the host Rags Srinivas encouraged the attendees to vote by sending text messages.

The rich client app demos were first. The task was to implement a desktop client that allows you to log on to Twitter and view your friends' feeds and status, and search for text in their postings. The ability to post was not required, but some of the demo'ed clients could.

The Groovy implementation clearly followed the MVC pattern and the language features made it very easy to parse the XML input; the GUI made a good impression. The JRuby implementation was designed using the NetBeans GUI builder (Matisse) and the Profligacy library, and therefor looked like a native app on MacOS; the users of this JRuby app will also appreciate that the build script generated native executables for different operating systems. The Jython app could save time by reusing an already existing model for accessing Twitter APIs; still the app was an odd one out, since it had to be started from the Terminal, and despite having a GUI with buttons to select Twitterers, the output was printed to the Terminal (frankly it looked as if he didn't have time to complete the UI). The Scala developer got started quickly by extending a SimpleGuiApplication class for desktop apps; Scala also made it easy to parse XML input, and the jury pointed out the clean error handling.

Next came the web applications. The application should access a MySQL database containing a world factbook, allow the user to browse facts about countries, and sort entries by criteria (language, population, etc). Additionally it should display the selected cities on a map.

The Groovy developer of course relied on the Grails framework together with Hibernate to access the database. The web application contributed by the JRuby community relied on the Rails framework and hooked up the components using the NetBeans IDE. The Jython web application relied on the Django framework with good-looking results. All three web applications made good use of their respective web frameworks and came with nice user-friendly web interfaces. Only the Scala team failed to produce the required web application and lost votes accordingly; instead, they demo'ed two other web apps, a chat client and a task list that use Ajax to keep the view up-to-date.

A quick look at the votes shows that JRuby and Groovy are presently the most popular choices in the audience... Will Scala and Jython catch up in the last round, where each team gets a chance to show off what their language can do best?

The Groovy representative decides not to show off demo apps, but instead he convinces the audience by talking about the seamless Java integration that Groovy is famous for. But then the JRuby submissions wow the audience with their smooth visual beauty: The first demo is a Star Wars-like scrolling Twitter client; the second demo is a 'Face For Steven Hawkins', a flock of colored dots that vibrate and change colors in response to audio input. Yes, admittedly, not very useful, but... pretty! The Jython representative chose to demo the Terminal-based Python help system that will soon be integrated into Jython too. The Scala demo was an application that searches and counts words in RSS feeds; it showed very well how Scala handles concurrency in minithreads.

Before the results were made public, the audience had a chance to pose questions to the experts. Asked about the relation of JavaFX to the other languages demonstrated today, Charles Nutter explained that each language was justified by its unique approach, so he does not see JavaFX as competition, but a powerful contribution to the variety of scripting languages. Another attendee asked how exactly languages such as Scala integrate with Java? All scripts written in these four languages compile to Java bytecode (war or jar files) that run on the standard JVM. Regarding Scala, Jorge Ortiz remarked that calling Java libraries from Scala apps is however easier than calling Scala from Java apps.

Finally, Rags announces the winner: [color=red]JRuby[/color]! [color=orange]Groovy[/color] comes second, then [color=blue]Scala[/color], and [color=violet]Jython[/color] ([url=http://weblogs.java.net/blog/rags]Check the final results in Rags' Blog, A=Groovy, B=JRuby, C=Jython, D=Scala[/url]). Jython had produced good results, but may have lost a few points for the terminal hacking required to start the applications, since all other contestants used IDEs. Although it felt a bit rushed and it was sometimes hard to pick up the details, this format of comparison is very suitable to get an overview of the "contestants".

评论(11)

  1. #11 楼 · lzycxy · 2009-09-08 10:50

    scala绝对值得你去学习

  2. #10 楼 · rovanz · 2009-08-16 15:00

    scala is wonderful

  3. #9 楼 · bneliao · 2009-07-25 14:22

    我因为对c++泛型支持的不足,c++ 0把concept剔出标准而找一个可以替代的语言,

    scala非常符合我的需求,他很自然,符合人的思维表达方式,而又有性能的保障;

    我非常喜欢scala,不过有scala插件的eclipse的ide做的不好,似乎连语法高亮都没有支持,

    如果ide上scala有一个提升就非常完美了

  4. #8 楼 · guava · 2009-07-22 21:44

    真正的项目里有用到这些语言吗?

  5. #7 楼 · 徐风子 · 2009-07-21 11:52

    groovy和java最亲近,学习曲线很小,可以一上手就用。 scala最有前途,之前不看好静态语言,但学了scala以后才知道静态语言原来还是大有作为的。 scala主要问题是语法太奇怪,学习曲线太大,但你习惯了以后就会喜欢上他了。

  6. #6 楼 · Eastsun · 2008-10-17 10:38

    Netbeans上的Scala插件很不错啊

  7. #5 楼 · aninfeel · 2008-10-16 17:54

    scala很不错啊,可惜编辑器支持太少了

  8. #4 楼 · Arden · 2008-06-15 10:28

    还是喜欢groovy,groovy调用java库非常方便。

  9. #3 楼 · gm8pleasure · 2008-05-20 09:21

    Scala太诡异了

  10. #2 楼 · jolestar · 2008-05-13 10:17

    呵呵,这样的比赛有趣。

  11. #1 楼 · Kaede · 2008-05-13 08:52

    不知道为什么要用这些 脚本语言! 项目代码维护 多了一项,项目中多了一份依赖:(

评论功能维护中,当前仅展示历史评论。