First Impression about the Play Framework

play framework

I was on my never ending hunt for new technologies and ideas and managed to catch a not completely new, but still young and very interesting framework. It has the simple name Play and can be found here In this post I’m going to give you my first impression about my experience. Before I start, let me say that I’ve left the Java boat a while ago. Mostly because a lot of frameworks on the JVM platform have grown big and in my opinion a bit messy. Some J2EE projects I was involved in had almost as many configuration files as source code files. Sure, one can argue that’s always up to the developer but I tend to prefer framework and tools with a clear structure and maybe even some borders to make sure everyone uses the same style and architecture.

Play Framework 1.0 vs. 2.10

A few hours after the Play Framework caught my interest, I was lucky enough to be on a train ride for a few hours and managed to get a hold on the Play Framework Cookbook by Alexander Reelsen. I found it easy to read and follow. He also covered most of the topics I care about: Basic structure, form handling, AJAX, security, REST etc. The only, and big cavet, it’s based on Play 1 while we’re at 2.10 by now. It still helped me to get a first impression about the slickness of the framework. Talking about the version, this is already the first thing that bothers me for a while. I certainly understand that there has to be some kind of evolution sometimes, even if it breaks the backward compatibility but I think it also causes a number of problems. When you search for a tutorial, a module or anything else related to play you’ll mostly find content related to the out dated version 1. I sometimes wished they changed the name because so many things have changed. The whole template system, which was based on Groovy templates, uses Scala by now. I guess some people are going to tell me that I can replace the template system. Well, I can but I don’t want to go a non-standard way, I’d like to stay where I find the most knowledge, the most articles and the most developers. In case you wonder, I tried to replace the Scala templates, it wasn’t difficult.

Luckily, there are some books in the work for Play Framework 2. Two are currently on my watch list: Play for Scala by Peter Hilton, Erik Bakker, Francisco Canedo and Developing on Play Framework 2 by Andy Petrella.

The basics for Play Framework

Since Play follows the MVC pattern very clearly, I felt almost at home when I started with it. Here are some random facts I found when I started to work with Play:

  • It work with the MVC pattern
  • A lot of code has been written using Scala but you can also use Java and maybe other JVM based languages
  • You’ll only need a copy of the Java JDK in addition to the Play Framework
  • There’s a copy of the H2 database included in the framework, no need to install anything in order to get a database into your application
  • Unlike most Java frameworks, you can change a single code file and reload the page in your browser, the framework will automatically compile the code. It takes a few seconds but it’s still quick enough to enjoy this feature. I feel that this could make things messy, but mostly enjoyed it because it makes learning so much easier
  • There’s a console you can use to create a new app (play new yourApp), run an app (play run) and more.
  • It’s stateless and should scale well. I’m saying “should” because I haven’t tried
  • There’s an asset compile which compiles your LESS files to CSS among other resource compilers. You can even build your own!

Performance of the Play Framework

The framework is pretty lean and runs on a built-in Netty webserver. You can run a different setup, for example with a reverse proxy, but when developing, the built-in webserver is very hand.y It looks like there isn’t much overhead, I managed to get 2500 requests per second on a quite complicated template. It’s not really much of a benchmark but as the title says, this article is just a first impression and the first impression about performance is great!

Closing Words about Play Framework

Should you use Play Framework? The worst thing in my opinion is the fact that we have two quite different versions out there. As a beginner you’ll need some time to find the right tutorials from time to time. However, the longer Play 2 is out there, the more tutorials, examples, project and books you’ll find. At some point this should become less of an issue. The fact that a company like decided to switch to the Play Framework should also help, more about this in this great article They posted a great introduction to get the famous Hello World up and running.

In other words: I can recommend the Play Framework and intend to use it for one project we’re working on and others might follow.


“Unlike most Java frameworks, you can change a single code file and reload the page in your browser, the framework will automatically compile the code. It takes a few seconds but it’s still quick enough to enjoy this feature. I feel that this could make things messy, but mostly enjoyed it because it makes learning so much easier”

Hum … isn’t this what JSPs have been doing since the time of the dinosaurs? You “touch” the file and it recompiles it the next time somebody loads it …

Correct me if I’m wrong, but from what I have in mind, my experience with JSP is hiding in the past, this only applies to the view itself. What if you change a helper class to send an email? Does JSP reload that too?
I haven’t investigated this, but I haven’t seen a lot of JSP projects lately. That’s why I wrote “most frameworks..”. But please let me know if you have made different experiences!

Remo is right, You can get the latest work on page refresh (without compiling) if you change the JSP’s ONLY, and not with the Java classes. Here with Play… if you change a SYSOUT (for say) you don’t have to compile the class… just do the page refresh and it will show you the latest SYSOUT. I must say its an extremely rapid application development framework.

jrebel has been out for ages, so the recompilation shouldn’t be an issue for those who opt to work with that. having said that it’s good that it’s supported out-of-the-box and not with the help of a 3rd party tool.

It’s not just compilation of classes, which jrebel does nicely (little bit pricey for my taste). JVM also “supports” this if you are lucky to get it work. Or you switch to NetBeans which kinda does it on some stacks.

It’s configuration and properties files, persistence and application wide settings and other low level things Play! also reloads on the fly.

Also for everybody working EE stuff, startup time of Play! stack is so much faster than Glasfish, JBoss and Tomcat.

So no more depoy or hotdeploy, no more waiting for container to start up, no more looking at stacktraces.

Leave a Reply

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