Lightweight MVC Standard

Source: Internet
Author: User

See the title, estimated that someone started to vomit, it's okay, you can spit it out and see, now there are a lot of MVC framework, there is no need to repeat the invention of the wheel, to declare that this is not to invent wheels, nor that time to invent the wheel, but to see so many MVC framework looks similar, want to unified interface, Reduce the cost of migration, in the Java world, the favorite is to set standards, and then is a lot of implementation, and here is also a standard to engage in, purely entertainment standards.

Note: The following definitions are narrowly defined, and you can define your own standards, which are not industry standards, to qualify the problem domain of this minor solution.

(a) Lightweight MVC definition:
1. The framework is non-intrusive to the application and does not depend on any interface classes
2. Frame 0 configuration, 0 annotations
3. Easy to use, easy to understand, not to be restful, lest complex

(ii) Lightweight MVC interface:
1. The controller uses setter injection request parameters and supports level injection, such as: Book.title.
2. Controller uses getter feed data to view, in view can be directly taken to the corresponding property values, such as: ${property}.
3. The controller handles the request with any non-setter and getter functions.
4. Controller takes the function return value to control the jump, only allows to jump to another controller, does not allow a controller to correspond to two view.
5. The controller's reliance on the model is automatically assembled by the setter, including the dependence between the model.
6. Session parameters, such as: Loginuserid, also through the setter injected into the controller, if the request parameters injected into the Loginuserid, will also be overwritten by the session parameters.
7. View and controller one-to-one, through name Mapping, and support a variety of view template type extension, such as: JSP, Velocity, Freemarker, commontemplate and so on.
8. When there is no controller, view can execute, which is equivalent to an implicit controller. 
9. The framework should provide a COC interface, which is based on rules that a package name is model, a package name is a controller, a directory is a view, For example: Com.company.module.controller, automatically discovers the module, and loads the model in a singleton mode, loading the controller in prototype mode.  
in a word, the interface has nothing in addition to setter and getter, and automatic mapping rules. &NBSP

(iii) Lightweight MVC access:  
/host name [: Port][/Application name] /Module name/Controller name/function name. html[? parameter name = parameter value] 
Note: square brackets represent a province  

(quad) Lightweight MVC implementation:  
conforms to the above interface implementation.  

(v) Lightweight MVC Advantage:  
business logic does not rely on any framework, can be adapted to any framework without impacting business code, when the old framework is eliminated and unattended, it can be migrated to the new, more stable framework in the quickest way .  

Ideal is good, the reality is cruel, the above is purely personal ideas, the reality is much more difficult, with a good vision is always better.

Lightweight MVC standard

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.