The lightest MVC, the original ORM solution elsewhere-Ruby on Rails 2nd

Source: Internet
Author: User

2nd 2005.7.15 is added to the comparison with the J2EE framework.

In the Java World, when hundreds of ORM frameworks and MVC frameworks fight together and attract most of the world's attention, Ruby on Rails appeared quietly.

Advantages
1. concise. Because it is something that the pragmatic programer helps out, It is very pragmatic. The dynamic language advantages of Ruby, coupled with powerful, highly automated, and crazy reflection base classes, so that the rails code is only one of the N parts of struts/webwork + spring + hibernate. The default crud system only requires one line of code.

2. Performance. According to the evaluation, the speed is 15%-30% faster than that of STRUTS + spring + hibernate.

3. Good semantics and field-driven development.
I think this is the most important thing. Active record adopts another domain pattern different from Hibernate's data mapper-active record, and obtains the most direct DDD pattern. Action Pack also draws on the advantages of many MVC frameworks and removes their complexity and becomes a bright spot. Ruby can also define semantics like DSL. I am also concerned with making programming languages colloquial.
 
Vs J2EE (first round)

Because of the above advantages, it is not all right to say it appears quietly. Many people have begun to uncomfortably compare rails with Java solutions. The results are similar, and rails is doing very well in Small and Medium Projects, however, it cannot adapt to complicated business logic. However, just like EJB saying that others do not support distributed systems, is there so many complicated models and logic? Moreover, rails is still developing and how it will be unknown in the future.

Objective

First, rails can be directly applied in Small and Medium-sized projects to achieve n times the development speed,
Second, it is more important to influence the orm and MVC design ideas in Java World in turn and improve their own frameworks.
Moreover, the entry to rails has a special feature. It takes 15 minutes to write a line of code to implement the first complete crud system. Unlike other languages, you can only print a hello World sentence, if it is really useful, it will take half a day.

Architecture
The ror architecture diagram is as follows. The server is Apache and the foundation is the most concise MVC solution-action pack and the most ddd orm solution-active record, coupled with a view template similar to JSP and a small code generator, it is rails.

Vs J2EE (second round)

Ibm dw Article Ruby on Rails and J2EE: Is there room for both? Detailed comparison and recommendations

It can be seen that both are based on the MVC and ORM modes, but their implementation philosophy is different.
MVC layer, both of which are based on the frontcontroller mode. The request is mapped to the appropriate controller through dispatchservlet/actionservlet. However, Struts requires detailed configuration of each ing and forward using XML, while rails is configured according to the default principle.
In addition, Struts advocates that each actionservlet complete an action, while rails advocates putting a group of related actions in a controller.

The ORM layer, data Mapper, and active recorder modes are quite different.
In the data mapper mode of hibernate, the session must act as the Mapper to map pojo between databases.

The active recorder mode allows pojo to encapsulate a row of data in the database and has crud default operations. For a group of pojo operations such as find and delete, the operations are placed in the static method of the class. Because there is no session for Mapper, the whole program is very natural and DDD.

Learning Materials

0. Grand recommendation
Koalant's Ruby on Rails practice (Chinese version, clear text, it basically does not need to look at other tutorials)

1. Quick Guide
Rolling with Ruby on Rails Part1,Part2
Use rails to create a web application

2. Ruby Materials
Programing Ruby 2nd progmatic bookshelf member. Version 1st is free of charge and is provided with the ruby installation package.
The latest version 2nd of ruby1.8 is charged. Fortunately, the following is an electronic version of Emule.
Some Chinese translations of progarming Ruby 1st

3. Information about active record and action pack
Active record
Action Pack

4. rails author and other rubyer blogs
David H. Heinemeier-lead of growth thinking rails
Andy
Dave Thomas

5. Ruby site
Ruby on Rails
Ruby SourceForge
Rubygarden
Ruby China
Ruby-CN

Related blog
1. hibernate3.0 vs rails active record

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.