The Play framework makes developing web apps with Java fun!

Sep 4, 2011

My students know me to be a "certified Java hater", so it may surprise them to know that these days, I am busy coding not in C/asm/Python, but in JAVA!!

How did this happen?

I was looking for a web framework to support the development of a site (for a new venture I am going to launch shortly). I had checked out almost all the Python frameworks, and had a brief fling with Rails. I heard rave reviews of a new kid on the block, called Play on Hacker News and thought I should try it out ...

A few weeks later, I have a small "e-learning" app ready in just about 1300 lines of code; and I enjoyed every moment of writing it! Let me put down some of my observations about Play.

First, the documentation is superb. If you are an experienced developer, you can learn a lot just by reading good code. The Play developers walk you through the code of a sample application in which they use almost all the stuff which is routinely needed in a typical web app. Midway through this code walk-through, you will be ready to start with your app. The walk-through is complemented by a more elaborate set of documents explaining each feature in detail. There were only very few instances during the development of my app when I had to look outside the official docs.

Play combines the benefits of static typing with the dynamism of a language like Python. You start the Play server, edit your code, save it and it is automagically compiled and loaded - the development cycle is as fast as that of Python! Plus, you get the benefit of static typing. There are endless debates regarding static vs dynamic typing - my personal experience is that as your codebase grows in size, you definitely need all the help you can get from the compiler and an intelligent IDE like Eclipse (with my old-school Unix background, I was never really a fan of IDE's - but I now realize that I was prejudiced - the support Eclipse offers for stuff like refactoring is very useful).

Play is full-stack. Everything you need to get most of your routine work done is integrated into the core; there is also a growing list of contributed modules. Play uses the production-quality web server "Netty" by default - so deployment is very easy (I use Nginx as a front-end because I have a couple of other stuff running on my server).

Play feels light-weight and very "Unixy" (ok .. this is subjective .. you will really have to use the framework to get the "feel")!

Error message appear neatly formatted in the browser window.

Play comes with integrated Unit/Selenium tests (which you can run in the browser itself).

There is a "CRUD" module which uses introspection (of the model classes) to automatically generate forms. This is very useful for building an "admin" interface.

Play uses JPA stuff for persistence ... I have no experience with these things, but I hear that they are very tricky (which I don't think is a problem with JPA/Hibernate ... I had trouble understanding SQLAlchemy ... maybe, objects and relational algebra don't really mix well).

The only real disadvantage with Play (especially for people coming from Python/Ruby) may be the fact that it uses Java - but don't worry, there is a Scala version of Play under development!

The important thing for me was that the framework appeared intuitive and very "logical". I was having fun using it, and I was being very productive! Maybe, you will feel the same when you give it a spin!

[Subscribe to our Newsletter] [Go to pramode.net home] [Courses at Recursive Labs] [Connect with me on Twitter/Facebook]