Wednesday, July 29, 2015

About Play Framework

About Play Framework:


  • Play is an open source modern web application framework for writing scalable web applications. It is written in both Scala and Java languages.
  • Play was created by software developer Guillaume Bort, while working at Zenexity.
  • Play is Action based MVC web framework for applications.
  • Play is based on a lightweight, stateless, web-friendly architecture. 
  • Play Framework is Built on Akka, Play provides predictable and minimal resource consumption (CPU, memory, threads) for highly-scalable applications.
  • Play Framework is a high-productivity Java and Scala web application framework that integrates the components and APIs you need for modern web application development.
  • The main aim of play framework is optimize developer productivity by using convention over configuration.
  • Play by design has a stateless and non-blocking architecture. This makes it easy to horizontally scale web applications written using the Play Framework.
  • Build and deployment was migrated to SBT(Simple Build Tool) and templates use Scala instead of Groovy.
  • Play framework has built in JBoss Netty web server. We can also create WAR file and deploy into other application frameworks like Tomcat, JBoss etc.
  • Play supports for push and pull based application controller calls. ( Push-based architecture also called "action-based". These frameworks use actions that do the required processing, and then "push" the data to the view layer to render the results. DjangoRuby on Rails, Spring MVC are good examples of this architecture.  An alternative to this is pull-based architecture, sometimes also called "component-based". These frameworks start with the view layer, which can then "pull" results from multiple controllers as needed. In this architecture, multiple controllers can be involved with a single view. Tapestry, JBoss Seam, Java Server Faces(JSF) and Apache Wicket are examples of pull-based architectures.)
History:

Version Released on Features
Play 1.0 October 2009
Play 1.1 November 2010 Migration from Apache MINA to JBoss Netty, Scala support, native GlassFish container, an asynchronous web services library, OAuth support, HTTPS support and other features.
Play 1.2 April 2011 Dependency management with Apache Ivy, support for WebSocket, integrated database migration, a switch to the H2 databaseand other features
Play 2.0 March 13, 2012 Typesafe Stack 2.0
Play 2.1 February 6, 2013 Upgraded to Scala 2.10 and introduced, among other new features, modularisation, a new JSON API, filters and RequireJS support.
Play 2.2 September 20, 2013 Upgraded support for SBT to 0.13, better support for buffering, built in support for gzip and new stage and dist tasks with support for native packaging on several platforms such as OS X (DMG), Linux (RPM, DEB), and Windows (MSI) as well as zipfiles.
Play 2.3 May 30 2014 Introducing the activator command, Build improvements, Java improvements, Web Services enhancements, Support for Scala 2.11, Actor WebSockets, Custom SSLEngine for HTTPS, Upgrade to Netty 3.9.3
Play 2.4 May 26 2015 Dependency Injection, Testing, Embedding Play, Aggregated reverse routers, Java 8 support, Maven/sbt standard layout, Experimental Features, Upgraded to Ebean 4, HikariCP is the default connection pool, WS supports Server Name Identification (SNI)
Reasons to learn Play Framework: 

We have several web application frameworks like Spring, Struts, JSF etc but still why we want to learn play framework because of the following reasons.

1. Developer friendly: what it means if you changing any thing in java code no need to stop and start the server. Here just you need to hit browser refresh button it automatically compiled (if any errors is there automatically displayed in browser) and runs the application. Play supports reload for the Java Code, Templates etc..

2. Supports both Java and Scala Programming: Play framework supports both Java and Scala programming language. Because of this reason, developer can select appropriate language for their development.

3. Reactive by nature:  Play frame has built in Server called JBoss Netty. It supports the non-blocking I/O operations. It is very easy and inexpensive to make remote calls in parallel, which is important for high performance apps in SOA ( Service Oriented Architecture).

4. REST Support: Play framework makes it very easy to write RESTful application. It has very good support for HTTP routing. HTTP routing translates HTTP requests into action calls. It has in built in JSON API for marshaling and un-marshaling so no need to add new library.

Play Framework Architecture:



Lets see the Pros and Cons of Spring and Play framework:

Spring MVC:
  Pros:
     1. Good raws throughput.
     2. Type safety reduces code rot
  Cons:
     1. Not developer friendly.
     2. Threaded synchronous approach difficult to scale for lots of I/O in a SOA environment.

Play:
    Pros:
       1. Fast for raw throughput.
       2. Non Blocking I/O at the core makes concurrency easy.
       3. Hot reloaded makes it is possible to get the things done quickly.
       4. Strong type safety throughout reduces code rot.
    Cons:
       1. Even with hot reload, a compiled statically typed language isn't quite fast as an interpreted dynamically typed language.
References:
1. https://www.playframework.com/documentation/2.4.x/Home
2. https://en.wikipedia.org/wiki/Play_framework
3. https://blog.openshift.com/day-30-play-framework-a-java-developer-dream-framework/
4. https://stackoverflow.com/tags/playframework/info
5. http://www.ybrikman.com/writing/2014/03/10/the-ultimate-guide-to-getting-started/
6. https://www.playframework.com/changelog

Happy Learning!

0 comments: