Java虚拟机上的脚本语言

在脚本语言、函数式语言纷纷成为后起之秀的时代,让我们总结一下Java虚拟机上的脚本语言吧!


List:
Groovy,Scala,Jython/python,JRbuy/ruby,BeanShell,CAL,Quercus/PHP,Rhino/JavaScript



1 Groovy
http://groovy.codehaus.org/
http://groovy.codehaus.org/Chinese+Home


Groovy就像Java的一个特别版本,除拥有Java企业级应用的性能及能力之外,也透过像闭包、动态类型、灵活简洁的语法、许多Builder工具等特性使其拥有很Cool的生产力。如果你是一个开发者、测试者或者脚本爱好者,你一定会喜欢Groovy。

  •     *  是一个基于 Java虚拟机的敏捷 动态语言。
  •     * 构建在强大的Java语言之上 并 添加了从Python,Ruby和Smalltalk等语言中学到的 诸多特征。
  •     * 为Java开发者提供了 现代最流行的编程语言特性,而且学习成本很低(几乎为零)。
  •     * 支持DSL(Domain Specific Languages领域定义语言)和其它简洁的语法,让你的代码变得易于阅读和维护。
  •     * Goovy拥有处理原生类型,面向对象以及一个Ant DSL,使得创建Shell Scripts变的非常简单。
  •     * 在开发Web,GUI,数据库或控制台程序时 通过 减少框架性代码 大大提高了开发者的效率。
  •     * 支持单元测试和模拟(对象),可以 简化测试。
  •     * 无缝集成 所有已经存在的 Java对象和类库。
  •     * 直接编译成Java字节码,这样可以在任何使用Java的地方 使用Groovy。



2 scala
http://www.scala-lang.org/

Scala is a general purpose programming language designed to express

common programming patterns in a concise, elegant, and type-safe way. It

smoothly integrates features of object-oriented and functional

languages, enabling Java and other programmers to be more productive.

Code sizes are typically reduced by a factor of two to three when

compared to an equivalent Java application.

这也是我最早接触的基于JAVA的函数式语言!当初刚一看到就去写了hello world

级别的代码:)


3 jython
http://www.jython.org/

Jython, lest you do not know of it, is the most compelling weapon the Java platform has for its survival into the 21st century - SeanMcGrath

Why Jython

There are numerous alternative languages implemented for the Java VM.

The following features help to separate Jython from the rest:

  •     * Dynamic compilation to Java bytecodes - leads to highest possible performance without sacrificing interactivity.
  •     * Ability to extend existing Java classes in Jython - allows effective use of abstract classes.
  •     * Optional static compilation - allows creation of applets, servlets, beans, ...
  •     * Bean Properties - make use of Java packages much easier.
  •     * Python Language - combines remarkable power with very clear syntax. It also supports a full object-oriented programming model which makes it a natural fit for Java's OO design.



Differences - Python & Jython :

Python
    * C
    * Multi-platform
    * Compiles to .pyc
    * Extend with C
    * GIL 1
    * Python Garbage Collection

Jython
    * 100% Java
    * Any JVM (currently 1.1+)
    * Compiles to .class
    * Extend with Java
    * Truly multi-threaded
    * Java garbage collection


4 JRuby
http://jruby.codehaus.org/

JRuby is an 100% pure-Java implementation of the Ruby programming language.


以上四种是比较主流、实践中有一定的应用规模的;除此之外,还有几个主旨在于证明可行性的语言:

5 其他基于JAVA的语言

(1 BeanShell
(2 CAL
(3 Quercus (PHP)
(4 Rhino (JavaScript)

 

OVER!

你可能感兴趣的:(java,虚拟机,脚本,groovy,jython)