J2EE framework Paoding-Rose

Source: Internet
Author: User

I haven't published any articles for a long time. I am not lazy. First, I am devoted to the examination and application. I have been busy with the examination and application from August to December.

You can do something else. In fact, it is also an excuse to say that there is no time. The main reason is that there is not anything worth writing technically, and you have never used it yourself. No

I am not very interested in writing quality hydrological or comments, non-technical things that are boring, reprinting the chapters of a book or translating foreign languages. So

Do not write anything.

Recently I made a technical selection for a product and played Paoding-Rose (Rose). In fact, I noticed this framework two years ago,

At that time, I saw an article by Renren's architect on Infoq, saying that the front-end framework Rose of Renren had been integrated by various J2EE frameworks at that time.

I am so numb, so I just downloaded it, but it has never been used. At that time, I was interested in dynamic languages and MacOS. The compilation principles and operating system classes involved a lot of effort.

(The last half is an excuse ). There is no Demo in the package downloaded from Rose's Google Code official website. There are only a few jar files. Wiki is available on the official website as a user guide to help

Developers use this framework. The Wiki is well written, and the official Demo can still be developed with diligence. Taking this opportunity, I used Rose for a small Demo

A simple employee management system, including basic CRUD, paging, upload, interceptor, Portal, and the Jade that comes with Rose for the persistent layer. The latest version is 1.01.

(In fact, it is not new, and it has never been updated in a year and a half). It is very comfortable to use, and the development efficiency is very high. If another script tool automatically creates a table and generates a CRUD

The rate will catch up with Rails. Why should I mention Rails here? It is because Rails has a shining feature, that is, conventions are better than configurations. (Do you want to say that the first letter of the two frameworks is R?

). There are very few articles about Rose on the Internet. Just fill in the gaps. First, I declare that I am not working for Renren. I just think this open-source box

There are some good design ideas in the frame, so remember it. Next we will talk about the seven obvious advantages I found during Rose usage.

1. Conventions are better than configurations

First, the Convention is better than the configuration. This advantage is my deepest experience. No configuration file declaration is required for the package path, class name, and class method name, as long as the name contains specific keywords and

Annotation is enough. As long as this condition is met, other naming sections can be modified without any configuration changes.

Package name and Class Name:

 

Annotation statement:

 

This is quite cool. When I used SSH single-pick projects, I had to write all the configurations. This involves the better question about XML and Annotation. In short, they have their own advantages,

I will use it on different occasions. The advantage of XML is that the configuration is independent from the code and does not need to be compiled. The structure is clearer and more intuitive, which facilitates management and modification. For example, Ibatis puts all SQL statements in xml

So it is very convenient to manage. Annotation provides an integrated solution that does not involve XML and other third-party technical standards. It is easy to develop.

Clean, don't worry about too many XML files. JPA is to use Annotation configuration for data ing, which is indeed clean. I will refer the attributes that change frequently to XML during usage.

To facilitate management and modification. Annotation processes infrequently changed parts, such as some data or path ing relationships.

2. Automatic Binding

Automatic Binding is also a very practical function. Compared with Struts, the obvious difference is that the form is automatically bound. When I used Struts2,

The struts2 label and set must be used to automatically bind form data. Rose does not need this. There are no tag restrictions. You can freely bind attributes and directly use

The Annotation parameter does not need to be set. The Jade framework of the data persistence layer also provides automatic property binding without any set or get methods, which greatly improves development efficiency.

3. REST style

Because Rose is developed based on Spring, it uses many Spring MVC components and brings the REST style of Spring MVC. Rose has Spring MVC

In order to verify the similarities and differences with Spring MVC, I made a special CRUD operation for Spring MVC 3.0 to compare development efficiency and implementation methods. Also

Rose is faster. Rose optimizes URL ing and page value transfer operations in Spring MVC and looks more elegant and fully supports REST.

4. Jade minimalism

The Jade framework greatly improves the development efficiency. Add an SQL statement to the DAO interface method to perform database operations and assign values ,:

In addition, of course, it also supports the integrated cache framework. Even if some cache frameworks do not provide particularly good support, I feel that it doesn't matter if I manage the cache myself, but it is more flexible.

You can decide which fields to save. I don't like to throw everything to hibernate management.

5. Portal technology

This technology is very handsome. It is also a java background original technology that is proud of everyone's network architects. The basic principle of implementation is for pages that require a lot of Data Rendering (for example

Public homepage) for page module segmentation, such as a module for listing, a module for leaving a message, and a new module for updating. Then, each module acts as a window concurrently from

The database obtains data and then reintegrates the data to present it to the user. You can set a time limit, for example, several hundred ms. If the data is not taken out within the time limit

This module is displayed to ensure the response speed of the client. This technology has also been baptized by SJ mujie.com and has indeed played a role. It is a very interesting design concept. Background Principle

Similar to scala's concurrency algorithm, data is segmented and then computed concurrently. The front-end effect is similar to the page fragment loading technology used by Sina Weibo. To ensure the user's response speed

Load part of the page fragments to gradually display the whole page. Facebook also has a set of similar implementation solutions.

6. Compatibility

Rose uses a filter instead of a Servlet to intercept requests. Currently, most frameworks use filters to intercept requests, such as Struts2 and Spring. The benefit of doing so is,

It facilitates compatibility with other frameworks. This also gives Rose a REST style. It can also coexist with Struts Based on Servlet interception requests to transform the legacy system.

Officially, Renren's front-end framework is transplanted like this.

7. develop good habits

The first is flexible interceptor control. For example, partial interceptor is based on the scope of the package directory, which can help developers develop good permission module segmentation habits. Second

Controller Method ing supports regular expressions and direct return of Json and XML format data, which can help developers better name ing paths and standardize output data. Conventions

Better than configuration, it also helps developers standardize the naming packages and classes. To some extent, Rose collects best practices to guide developers to comply with the standards. Finally, if the framework has bugs or compatibility

The problem can be solved by modifying the framework source code.

PS: if you are interested in Rose, visit the official website. Link: http://code.google.com/p/paoding-rose/. wikiwrite is complete.

I wish you a happy New Year. I came back.

 

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.