The Play Framework: shall we play?

Play_framework

WHAT IS IT?

The Play Framework is a modern open source lightweight high-speed web framework designed for Java and Scala. It helps building scalable web applications without affecting developers’ productivity. This framework is built on Akka and it consumes minimum of predictable resources such as memory, CPU and threads. The Play is based on non-blocking architecture which is both web-friendly and stateless web tier, and it follows MVC architectural pattern. The optimization of productivity is achieved through utilizing hot code reloading, convention over configuration and error display in a browser. The Play has the features that simplify horizontal scaling of web apps when written with its use. It is also perfectly suitable for web and mobile apps.

ADVANTAGES

The Play Framework is a set of helpful tools and utilities which provide an entire ecosystem to empower velocity of Rails prototyping, however it is mature and flexible enough for the serious work also.

The Play ecosystem has the elements from the build process such as SBT to testing like FakeApplication and JUnit up to running applications such as Netty, together with modern framework add-ons.

This framework allows for the project launch without any preliminary adjustment of tomcats etc. plus recompilation of the source codes is on the go. The new evaluator was added, and if the page is updated, the evaluator gets picked up. There is an exception for recompiled resources though: plug-ins, libraries and others, when adding a library an application has to be restarted.

The Play Framework includes essential tools which allows saving time on their initial settings. For DB support there is embedded JPA (Hibernate) based on configuration through annotations. In addition there is a super-class developed for beans that reduce all the issues with EntityManager approaching zero.

For the log it is sufficient to write Logger.error(throwable, String). log4j – it has already been set for the use.

If validation is required, the forms can pick up the annotation field beans.

For admin panel only one line in configuration file CRUD module gets connected and provides the interface for objects editing, which are stored in DB. It also has large capabilities to customize the attributes of the object, etc.

In terms of security the check is done very easily yet properly. All that has to be done is importing the security module and describing the login process – the check of the password etc.

The template engine looks nice. The basis of the engine is Groovy.

There are a lot of possibilities, logical conditions building, other templates inclusions and declaration of variables.

The engine can form URLs for ajax-requests to specific controllers, there is a #{form} tag which will write the necessary action etc.

The Play framework is open source and it supports third-party plug-ins.

There is already a great deal of third-party plug-ins allowing, for example, to integrate with MongoDB, GAE etc.

The full list of officially published plug-ins can be found here: www.playframework.org/modules

Regarding TDD there is a startup mode in the test mode, automatic performance of a series of tests and convenient testing interface.

In other words, what benefits the Play framework brings to the table in general? There is a set of pros summed up below:

  • Java and Scala – performance of JVM, safety, IDE/tooling support, powerful console and build tools, built-in testing tools, libraries, large community.
  • Open source – there are open code and plug-ins available at GitHub repo, open source plugins, user group, documentation and Stack Overflow.
  • Quick iteration – once the changes are made to the code, they can be seen whenever the page is refreshed.
  • Flexibility – almost all can be customized, changed and configured.
  • Support – commercial support for the Play is provided by Typesafe and Zenexity.
  • Reactivity – non-blocking I/O making parallel data gets received easily and possible for the real-time web.

WHAT’S IN IT FOR DEVELOPERS?

Happy-developers

Basically the goal of the Play is to remain productive and efficient without having to write tons of code lines and using IDE with the proper tools, deploying and re-deploying on existing online Java container to test ‘Hello World’. It is lightweight and scalable, and it should have been created a while ago. It is also designed to develop as quickly as it gets with a possibility to see an intermediate result.

As a developer you receive an option to combine Java and Scala in any project type that you see fit. The actual web development with the use of this framework is a true alternative to Enterprise Java.

Thanks to JVM capabilities there is a simple way to fix bugs and see modifications without restarting the server which is done a lot like in LAMP and Ruby on Rails environment.

This framework was created for the requirements of current mobile and online apps using such technologies like REST (by default), JSON, Comet, WebSockets, EvenSource, Less Asset Compiler for CoffeeScript, Big Data Support and Extensive NoSQL etc. They enable developing extremely interactive and rich UI reproduced by virtually any browser. Simultaneously this makes it simpler to show elements of a page in parallel and make partial updates of the page or progressive improvements. For the compiler and the runtime to speed up the applications and keep the under load running the Play runs on JVM, the code is compiled and Java NIO runs via Netty.

The Play enables delivering top-notch software quicker thanks to the high-class support for the latest web.

The learning curve is very quick especially compared to other Java web frameworks. You will appreciate this framework the most if you already have certain Java experience behind your belt. However, for beginners the Play remains intuitive and there is no need to be a guru in Java to learn using it fast.

There’s no requirement to have a lot of RAM, it runs fine on Google App Engine. The libraries aren’t large, and you can use one at a time with the module mechanism. There is also no dependency on JARs.

The maturity is still evolving but it’s moving fast and is constantly improving, and it’s rather stable in its current features. There are certain compatibility issues but there is a very active community so everything gets solved fast.

There is one of the greatest speed developments throughout Java frameworks. Java use in this framework is classical and the runtime improvements are light and optimized, so there aren’t many issues in writing a reusable code. The help can be found within the strong community.

WHAT ARE THE CONS?

There’s nothing perfect in the world, and so isn’t the Play. Play 1.x and 2.x are completely different and the whole parts of their environment have been changed and redone. For beginners quite some time will be required to find the right manuals to get it in order. But eventually, with all the material provided it becomes less of a problem.

SUMMARY

The Play looks like a very well developed framework with a lot of space to experiment and play around. We encourage developers and others eager to research fast prototyping and the rest of concurrent approaches for their apps.

Shall_we_play

About the AuthorAndrew Shalimov

“Andrew has been working in IT for 17 years. His career started out back in 1997 as a Junior Java developer right after his graduation from Kharkov University of Radio Electronics where he got his MSc in Computer Science. Ever since he’s been practicing his skills with Java, JS, Delphi, C, SQL, HTML and ANT script for over 10 years.
Today Andrew specializes in developing backend solutions as a Senior Java developer. The technologies that he majors in are JSF, Seam, Spring, Struts, Hibernate, OSGi, Java Servlets, Applets, JSP, JDBC, EJB, RMI, GUI, Sockets, JMX and JNI.
Up until today Andrew’s taken part in over 12 projects while working with different organizations. So he’s got a great deal of experience with both Ukrainian and international customers while his expertise in commercial software design and development is a real find to Acceptic where he is employed.
Back in the day he has implemented client/server communication systems and algorithmic tasks. In addition he has more than 5 years of experience as a computer technician and a system engineer. He’s an expert with hardware support, PC tuning and LAN set-up. “

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>