Last year I experimented with the Play Framework to find out how it works and what its strengths and weaknesses are. Although I was quite enthousiastic about it, I did not look at it any further, seeing no immediate need for it in my professional life. Now, a year later, I decided to dive into Scala. A free online course is being given by the creator himself, Martin Odersky, on Coursera. I am very happy about both the presentation and the level of the course. The lectures and the exercises are of a high level, and the whole package is well thought through.

As it turns out, the two can be integrated seamlessly, as Scala is the native language of the Play Framework, and is one of the languages of choice (Java being the other) for projects. Here are some findings that I have about the both.

As many Java developers, I am quicky falling in love with Scala. Its syntax is very elegant, but most of all being a functional language it is extremely powerful. At the same time you don't have to throw Object Oriented Programming overboard. Scala is specifically designed to suppport both OO and functional programming. As Odersky says it, the two paradigms don't interfere and can be used together well. To be honest, I can not think of anything why Java should still be favoured over Scala, other than the smaller pool of programmers with knowledge of the latter.

The idea of the Play Framework is to bypass the entire Java Servlet stack. Instead it has its own stack built up from the ground. Very noticeable are the short cycles in the development. You edit some code, refresh and see the output in the browser window. No need to look at an empty screen and look at logging to find out what has gone wrong. Even compilation errors show up in the browser. There are numerous helper utilities for HTTP traffic handling, remote web service calling, JSON handling etcetera. In general, working with Play is really fun! It brings back the joy in web development that has been far away with many previous frameworks.

In my research I have started an app that currently does nothing more than make users log in through Facebook or Google. On first login, a User object is created and saved. All other domain classes will circle around it, like with most typical apps. There are two advantages to this approach. First, I don't need to write the authentication myself, and just rely on Google and Facebook to do it better than I possibly could. I also can't make any passwords leak, as I simply don't have them. Second advantage is that I will have access to the users friend list and other data at a later time. As it is such a common requirement, I decided to save the app in its current state as a template for new Play Framework/Scala apps where logging in to social networks is required. The code is on Github: https://github.com/jkransen/PlayScalaGoogleFacebookTemplate. Feel free to download/fork it and start your own project from there.