jinfeng_wang

          G-G-S,D-D-U!

          BlogJava 首頁(yè) 新隨筆 聯(lián)系 聚合 管理
            400 Posts :: 0 Stories :: 296 Comments :: 0 Trackbacks
          http://www.javaworld.com/javaworld/jw-03-2005/jw-0314-scripting-p4.html

          最重要的信息:“目前有so多的Java scripting language”, :-)

          轉(zhuǎn)一張?jiān)u測(cè)圖:
                         

          作者的final thoughts還是挺有意義的:

          Final thoughts
          If you need to integrate scripting support code into your Java application, my advice is to pick a single scripting interpreter and standardize on it. Costs are associated with each scripting language you support in your product, so don't make more work for yourself by trying to hook more than one scripting interpreter into your application. When adding scripting support, you can further simplify things by using an interpreter written in Java instead of a native interpreter such as Python or Tcl. That will make your solution more portable and simplify the integration task between your Java program and the interpreter.

          If your developers or customers are already familiar with a particular scripting language like Tcl, Python, Ruby, or JavaScript, obviously you'll want to look seriously at the interpreter that supports that language (Jacl, Jython, JRuby, or Rhino, respectively). If you don't have that constraint, you will have a harder choice. In some ways, it's a bit like going to a new car lot. All of the choices will work, so you are left with balancing the differences between the alternatives, such as performance or options.

          Some of these interpreters perform simple tasks faster than others. Some are updated and released more often, or have better documentation or debugging facilities than others. Some support compilation of scripts to bytecode. Some have language syntaxes that will either appeal to a developer or not, depending on preference, programming background, and the specific task at hand. As with most engineering tasks, you have to define your requirements and then investigate some to come up with the right answer.

          If I had to distill what I learned from working with the different interpreters down to a bare minimum, here's what I'd say:

          Jacl eases your entrance into scripting. Integration is simple, and if you need your scripts to be written in Tcl, it works well. If speed is your top priority, you may want to consider other choices.

          Jython is one of the fastest scripting interpreters. From looking at the Website, it seems that Jython development is about to renew, which is good news. There are several good books on Jython. If you like the Python language, Jython is a solid choice.

          BeanShell is not as fast as the quickest of the interpreters, but the 2.0 release supports loading of ordinary Java source, which is a strong selling point. I tried loading and running several Java source programs as scripts and found BeanShell to work fine, which is impressive. The libraries are well-organized and make integration simple. If performance is not the single most important criteria for your scripting interpreter and you want to write Java scripts, look at BeanShell.

          Rhino is the winner of the performance benchmarking test and also supports Java-like syntax in its scripting. There are plenty of books on JavaScript available. Rhino appears to be well supported, and the distribution includes a useful debugger.

          Pnuts is one of the fastest scripting interpreters. I am impressed with the completeness of the documentation, the simple usability of the debugger, and how straightforward it is to get things working with Pnuts. If the Pnuts syntax is a good fit for your needs, this interpreter deserves a good look.

          JudoScript is in the middle of the pack for the performance benchmark, but supports a JavaScript-like syntax that is easy to learn. The documentation seems to be thorough and well organized, and the distribution includes lots of script examples. I ran version 0.9, which seemed to work well.

          JRuby brings the feature set of Ruby to the table. It isn't the fastest of the interpreters, but if Ruby syntax and functionality is important to you, take a look at this interpreter. I ran version 0.8, which seemed to work just fine for my simple tests.

          Groovy has attracted quite a bit of attention and development effort in the Java community. It is one of the fastest interpreters on the benchmarking tests, even without compiling the scripts down to classfiles. The syntax is Java-like and supports some powerful features that Java doesn't. This is an interesting addition to the programmer's toolkit that has a lot of potential.

          posted on 2005-03-15 08:47 jinfeng_wang 閱讀(300) 評(píng)論(0)  編輯  收藏 所屬分類: java 、ZZ
          主站蜘蛛池模板: 焦作市| 彝良县| 区。| 蓬溪县| 浏阳市| 荔波县| 清水县| 濮阳县| 敦煌市| 金坛市| 九寨沟县| 通化市| 仙居县| 绥阳县| 陕西省| 江孜县| 安康市| 屏边| 女性| 高陵县| 常宁市| 驻马店市| 长治市| 宜君县| 汝南县| 山阴县| 宜宾县| 葫芦岛市| 石林| 普兰店市| 博湖县| 拜泉县| 海口市| 泽库县| 垦利县| 田林县| 剑阁县| 武定县| 隆昌县| 兴业县| 淳化县|