Write Business Classes in dynamic languages under the spring + Hibernate framework

Source: Internet
Author: User
Tags ruby on rails

If you envy Ruby on Rails, you can use dynamic languages for coding, but you are reluctant to use the Java er frameworks such as spring and hibernate, there is a compromise:
We still use the spring + Hibernate framework, and use groovy/Jython/jruby to write controller classes, service classes, and Dao classes, and compile them into common Java class files for use.
The blog of buggybean demonstrates this scheme with Jython.

 1. Why dynamic language?
Today's dynamic languages are very object-oriented. They are different from the traditional script language used to write Peripheral scripts (test and install), and groovy, Jython, in addition to dynamic loading, classes written in jruby can be compiled into static Java class files. Therefore, jruby can well assume the role of business classes in J2EE applications.

For more information about the benefits of dynamic languages, see <one ton of benefits of writing business classes and frameworks in groovy>.

2. Gossip: Java implementation in various dynamic languages
Groovy,
Beanshell,Jython(Python ),Jruby(Ruby ),Rhino(JavaScript ),
Jacl(TCL ),Bistro(Smalltalk ),Kawa(LISP/Schema)

 3. What kind of Dynamic Language?
Jython is always interrupted and retained, and is only transplanted to jython2.1, which is a few times slower than python2.4.

What about jruby? Dion almaer said in jruby0.8.2: "The day jruby gets up to Jython levels, and then C Ruby levels, will be a great day.", literally jruby is less reliable than Jython.
Another bad thing about Ruby is that there is no good ide for the moment (even the paid ruby-Ide is weak). If there is no good ide, it can offset the advantages of most languages, it cannot be imagined that Ruby on Rails was written in an ultraedit-level editor.

The weakness of groovy is that the official 1.0 version has not yet been released, and the user community is not large yet.

Because the selectedWhich Dynamic Language is embedded in the Java framework as the service class?. Therefore, the user community of Python and Ruby and a large number of existing projects are not very useful. Groovy is a better product than two others,
1. As an illegitimate child, embedding is of course the best, and the relationship between the two is so ambiguous.
2. another natural advantage is the ability to be compatible with Java syntax. The ability to copy Java code to groovy makes almost no changes (only does not support throws definition statements and inner classes), and the learning curve of the team is smooth.
3. Because it is not a transplant project, there is no time difference during language upgrade, so you don't have to look at the face of the transplant.

So, I will select groovy and wait for its official version to come out.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.