The Play Framework 1.0 of the bloated Java EE development framework bloated Enterprise Java stacks was released. It has revolutionary originality in many aspects and helps us understand the shortcomings of the current JavaEE framework.
The Play framework incorporates php ruby's Dynamic Language Features and uses real-time source code writing and instant activation. The framework integrates the compiler and server. The compile-package-deploy process is replaced to improve product development efficiency. The Play framework even provides an online editor, which immediately changes bugs online and puts them into application.
Main architecture features:
1. A very simple development cycle. This framework automatically compiles and reloads any changes to the source file.
2. Simple stateless MVC Architecture: intelligently bundling HTTP parameters to Java method parameters.
The Play framework considers that the database is saved and the browser can also save the status. What should the middleware MVC Save the Session status?
HttpSession has many problems. Although it can handle the status of a user, what should I do if the user leaves midway through? HttpSession has problems with resource consumption and scalability. The Play framework adheres to the idea of the share nothing architecture and does not crack the original normal Http model as a hacker, and then forcibly implant the status. The stateless architecture can output multiple pages in parallel to improve Web performance .)
3. built-in quick HTTP Server Based on Apache Mina.
4. A powerful Groovy-based template engine with multi-layer inheritance and Custom User tags. The Play framework considers that the JSP & Expression Language template mechanism is good, but too many configurations are required, absorb the template design and remove the configuration. .
5. Excellent error reporting function: When an exception occurs, this framework displays the error code, or even the template code.
6. RESTFul
As we all know, Servlet APIs and Struts are actually distorted. Using strange APIs to hide the Http protocol, the Play framework believes that a Web application framework should be completely and directly called and used for Http, which is actually a RESTFul spirit.
In this way, URI is the main concept of play framework.
To call a Java object, you can use the URI instead of writing a Java statement, as shown below:
GET/clients/{id} actually calls the show method of the Clients object.
7. Integrate the JPA Persistence Layer
The Play framework uses JPA for persistence and makes it easier to use. Personal Opinion: This Code directly coupled the persistent layer and the presentation layer, without seeing the Domain Model. It seems that it is not easy to popularize DDD in every corner .)
8. The cache support is integrated and memcached can be used as the distributed cache.
9. Integrated with SSO technology such as OpenID.
10. Propose Component Reuse. You can reuse various components, including CSS and Javascript.
Personal comment: In general, the Play framework is a framework that competes with Struts2 JSF Tapestry, but integrates the persistent layer and server.
Business System Market Analysis:
90% of open-source web business systems are php versions, especially the open-source implementation of emerging products. java has almost disappeared. It is a pity that j's family members who want to read php-style code is simply abused. This actually demonstrates that the beautiful java architecture is still very valuable. But the beautiful + pragmatic balance is the best choice.
Framework comparison:
Running Mode and server compatibility:
Play applications can run in the following ways: Standard Servlet containers, independent servers, Google App Engine, and Stax cloud computing platforms.
You can also publish an application to a standard application server for execution. Most applications support the Play application.
The following application servers can be used to run the Play application.
These application servers are tested to support Play 1.0.2, but other versions have not been fully tested.
JBoss 4.2.x |
JBoss 5.x |
JBoss 6M2 |
Glasshfish v3 |
The IBM Websphere 6.1 |
IBM Websphere 7 |
Geronimo 2.x |
Tomcat 6.x |
Jetty 7.x |
Resin 4.0.5 |
Bytes |
Bytes |
Bytes |
Bytes |
Bytes |
Bytes |
Bytes |
Bytes |
Bytes |
Bytes |
Detailed analysis and external introduction:
Is a set of all jar packages used in the Play Framework framework, located in the {play}/Framework/lib directory
Play! Framework is a project in 1.0, open-source in, and released version in. I have been learning this framework since its release. Now the official version is 1.01, and 1.1 is also updated on a daily basis. You can download the released version and the latest daily version in the http://download.playframework.org.
Bc. # Additional modules
#~~~~~
Mdoule. gwt =.../gwt
Module. cms =.../cms
Module. forum = ../forum
Module. directory = ../directory
Learning Play! In the process, the most common feeling is-it's too simple! It's not about Play! It is a simple design framework. On the contrary, Play is found everywhere during learning! Design integrity, which even includes website design and learning documents. Play! It is easy to learn and use. Use Play! Create a project. All directory structures are automatically created. Play! Abandon the traditional JSP, Servlet technology is too great), and provides a very easy-to-use MVC framework. Play! Built-in support for JPA and built-in Hibernate as the default persistence engine.
Play! The HSQLDB database is also built in. It supports memory databases and is very convenient for project development and testing.
Play! The Controller uses the naming convention:
- <form action="@{Application.createUser}">
- <input name="name" />
- <input name="password" />
- <input type="submit" value="Create User" />
- </form>
No other configurations are required. Play! The name and password parameters in form are automatically mapped to the createUser method.
View layer Play! Use the html template written in Groovy syntax to render it with parameters of the render () method and return the result to the client.
External introduction:
Play! Although simple to use, the scalability is very powerful, and the length limit cannot be detailed. Http://www.playframework.org is Play! We recommend that you visit the official website. Play! The document is very detailed. I have a hand-held tutorial on creating a Blog engine in this tutorial. I believe that it will definitely help you learn to Play after you have done so! Framework, then you will fall in love with her!
It seems that the normal development process is always faced with the problem of building a project prototype, re-invent the wheel, or move the previous guy style out and reuse it? This scenario is not the best choice.
90% of open-source web business systems are php versions, especially the open-source implementation of emerging products. java has almost disappeared. It is a pity that j's family members who want to read php-style code is simply abused. This actually demonstrates that the beautiful java architecture is still very valuable. But the beautiful + pragmatic balance is the best choice.
This is not the case. The full-stack framework based on java's RoR-like style is back to my sight. A few years ago it was appfuse and I had several small projects based on it, however, it is already a little more familiar with appfuse. Appfuse looks like a toy, mainly demo show + study.
Later, springside emerged in China. It should be based on appfuse, Which is simpler and more in line with national conditions. It is no problem to develop small and medium-sized projects based on springside, but few open-source products in China continue to become more and more robust through multi-person collaboration in the real sense, and the version release plan is always listed and backward compatible, the quality of core code is unstable.
Now play! Framework. Several colleagues are also interested in play! Framework is very optimistic. It seems to be the most ROR in the java camp, and the most easy-to-use framework for java developers.
I have to admit that web development is already dominated by php and other scripting languages. Even if you develop a new generation of enterprise-level products, you will find that Internet-based + lightweight is also a trend. Even IBM team collaboration software-Lotus Quickr, although the server is an old system that has been developed for more than 10 years. However, what quickr needs to do is to expand services on the server layer. In this way, even more complex systems can be installed on the front-end application layer.
Many java developers are not concerned about the ROR style, or even do not understand it. Maybe sun + ibam has been poisoned too deeply, right? In fact, spring's xml based on interface bean management is often written once, and it has never been modified before it is deprecated to the project.
Java itself too much emphasizes the general, abstract, configuration, and even too OO java syntax. In the era of java's birth, this approach is very advanced, today's web application development is a specific field. This kind of practice that does not keep pace with the times and does not take into account the actual characteristics of web development is a bit tricky, it cannot be used as a new dynamic scripting language designed for web development scenarios. After all, java is not a language designed for web development. Over time, java is becoming more and more bulky, and the version upgrade is slow. We look forward to jdk7's enhanced support for dynamic languages: JSR292. But this is not enough, just like ruby on rails. There is also a rails framework. Java official step is really... Only unofficial frameworks can be used.
In China, at least half of enterprise-level systems are smaller than online Internet products. In particular, Chinese Internet companies are still playing hard Qigong, and many enterprise-level system development within the company is still at the level of one person, and two or three people are at the level of one system. In this case, some people think that play! The framework is not necessarily suitable for complex business systems, so it is also suitable for system development in such scenarios.
There is a reason why appfuse updates are getting slower and slower. Because play! A new generation of java ROR full-stack framework, such as framework, has been developed. Grails and JRuby also occupy the market of the new-generation java ROR full-stack framework, but play! The benefit of the framework is that it is compatible with existing java code and syntax and is more suitable for transitional needs. Of course, because of the strong type of static security check language based on java, this is bound to use some hack techniques to make play! Become very ROR.
I found some information on the Internet over the weekend and played play on my computer! Framework, which is indeed better than appfuse and springside RoR.
Play! The framework is a stateless mvc framework. With memcached, horizontal scaling of clusters should be good .)
Play! Framework supports j effects similar to jrebel. It is convenient to modify java code without restarting and hot deployment. You no longer need to repeat edit-complie-deploy-and running.
Also, the most troublesome java mvc Framework is the view-layer template language and js implementation. play! Framework uses Gsp Groovy server page) and jquery framework. The template syntax is much more concise.
Do not be blinded by the word play. play! Framework is still very DDD. The anemia model of the set method is missing only because of the attribute and get. Instead, the anemia model of the set Method is a congestion model with behavior, which is DDD.
Play! The framework is really full-stack, and even httpserver provides you,
Play! Framework replaces Maven with Python to create, run, and interact with the system. The learning cost of appfuse is high. It is actually spent on maven configuration, understanding, and usage. Python should be more suitable for dealing with systems.
Play! Framework itself supports the plug-in mechanism. Expansion should be fine. It is estimated that there are also a lot of available components, this is very important, http://www.playframework.org/modules:spring, orm should also have Ibatis), lucene search, MongoDB, and even Scala. They are all very good.
If you want to use no-sq on the Model layer, the Siena component can introduce Siena orm + mongodb)
The siena module automatically enable Siena support for your application.
Read more at http://www.sienaproject.com/
I think the framework that supports pluggable components is the most important indicator for measuring a good framework. It is very difficult to reduce the complexity of the framework. Many open-source implementations make the same mistake. It takes a long time for you to get so greedy and chewy. Play! The default configuration of the framework is really refreshing, and even spring bean management is not the default configuration. It is exactly what I want to add according to business needs. Haha.
Disadvantages:
Someone claims play! The framework is not suitable for collaborative development by many people. The system core developers with tens of millions of users on the portal website will not exceed 5-8. What's more, when many people develop, they should be responsible for one person as much as possible. On the contrary, many open-source frameworks have taken too much consideration of the multi-person collaborative development scenarios that do not conform to the actual situation in China, the framework is too loose and too streamlined. When two people develop projects, they feel that they are in trouble. Therefore, it seems that it is not suitable for collaborative development by multiple people.
Ror coc is the habit of changing java programmers to strive for interface-based programming, generic, and explicit configuration. Most web application developers only need to implement interface-oriented programming at the webservice restful api level, and the versatility is basically enough. Do not forget that restful APIs are already a very good abstract architecture. In this way, web developers can improve development efficiency and put time and energy into the business logic itself, so that agile development is possible. Think about it. If your development points and time are all spent on preparing for a rainy day, sitting in a chair and imagining demand changes in the past n years, and making the so-called interface-based programming, coupled with slow compilation, how can deployment and operation be adapted to the requirements of agile development? Instead, it will lead to a project, which is very elegant in the early stage and ugly in the later stage. All code is piled up in action or jsp. Why? In the first place, we lowered your noble head and went to ROR calmly and pragmatically.
In short, to put it simply, if play! The framework is truly compatible with the advantages of dynamic languages such as java, php, and ruby, which is one of the best choices for java developer web development.