Play framework – The next web server phenomenon

As I have learned, there are more advancements in Web technologies which makes software development much easier, less complicated, and its end product to be highly efficient, stable, robust, fast, reliable and yet takes complex requirements. And top of it all, it should never take the user experience for granted, and keep in mind the developer experience as well.

Play framework is an emerging technology. It is a web server that can be created in Java or Scala. ( Scala is not as popular as Java, but it was created to address Java shortcomings ) It is foreseen to replace the J2EE web server technologies. It is comparable to MongoDB ( or any NoSQL ) , which has very high potential of replacing the SQL.

To code using Play framework, the concept is in MVC but without servlets or any web server, since Play is already the web server. Other MVC frameworks will not be used also ( ex. Spring ). Front end code is still needed such as Javascript ( or CoffeScript, JQuery, AngularJS ) and CSS. Server side logic can be coded using Java or Scala.

Comparison with J2EE: J2EE web technologies have been the standard and reliable web server on most enterprise applications, with Java as the top programming language of choice. J2EE technology is built on top or constructed with other modules to make it functional. A full stack J2EE web application should have a J2EE container / web server, the J2EE application package itself, which is integrated with a MVC framework such as Spring and a Database access component such as Hibernate. Currenty J2EE application have become bloated with layers of modules and log files have too much hierarchy. It is because J2EE has become an increasing version of add-ons and enhancements.

Play framework eliminates all of those J2EE modules. It is not a Servlet technology. Play framework is a Non-Blocking I/O. Non-Blocking I/O means that HTTP request and processing in CPU side of the server is asynchronous, Yet Servlet 3.1 already supports Non-Blocking I/O, Play framework has Websocket support, which is not in Servlet 3.1. And best part of Play framework is the simplicity of the debug logs and application modules, where J2EE has its drawbacks.

I’m really impressed with this new Web Server advancements in Play framework. It is really comparable to the shift from SQL to NoSQL. SQL and NoSQL databases have the same purpose, a Database, yet its design and architecture is completely different. For simplicity, yet have served its function as a Database, NoSQL ( ex. MongoDB ) does it. It is much easier to setup ( ex. in Java, we just need the libraries and codes for transaction ), compared to SQL ( ex. Hiberante ) , which needs code, models, configuration files, and even integration with Spring to make its code less. So in this case, Play framework is like the NoSQL solution to an already legacy code such as J2EE.

Some Cons: Yes Play is better, but it is still new. So there may be some uncertainties hiding in the code. Another drawback of Play is the Scala and its build code ( called SBT , which is similar to Ant / Maven ). Play is built in combination with Java and Scala, So for non-Scala developers, it’s a steep learning curve.

Production components: For production and deployment, Play is integrated with Netty ( HTTP server ) and Akka ( Background Process ). No need of Webservers ( Tomcat, JBoss, IBM Websphere and etc.. ) . Other sub components are Templates, SBT and Websockets ( Websockets and be used as an option only ). Just include front end JS and CSS to be added in Play. Other third party libraries in Java ( if using Play as Java based, not Scala based ) can be added.

Bonus Factors: This technology is really new, with only a few enterprise websites using it, and as of this writing, they only have 5 on their list. See the list here in their home page. LinkedIn is one popular site using Play, so there is no question of its performance. I also checked zaptravel.com , and it loads pretty fast too. Compared to MongoDB which already has numerous users, across all industries, so similarly, in a matter of years, Play framework will get more attention.

Highlights:

– Lightweight
– Has authentication and security
– Can easily be switched from development mode to production mode via a single configuration.
– Has support for Design Patterns ( ex. Singleton and etc .. )
– Not a Servlet
– Not tied up to SQL . Can handle other Database types also
– No need of Web Server ( Or a servlet container ). The Play framework is the server itself.
– Can be scaled for production
– pretty darn straight forward, not so layered.
– Supports Unit test
– Better error detection / Direct to the point compile errors, does not display a full stack trace
– built as non blocking I/O. Adapts to multi core CPU.
– Much better compared to node.js and ruby on rails. Which I still have to find out the reason…

Here’s the explanation why Play framework is really fast.
https://playingscala.wordpress.com/2015/05/01/why-play-framework-is-fast/

Some important links:

1.) routing of http requests:

http://stackoverflow.com/questions/15907996/how-to-get-query-string-parameters-in-java-play-framework?rq=1

2.) basics

https://www.playframework.com/documentation/1.2.x/faq

3. ) philosophy

https://www.playframework.com/documentation/2.3.x/Philosophy

4.) One user even got embarrassed.. or how it is unbelievalbe good.

https://dzone.com/articles/play-framework-now-officially

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s