Typesafe Stack Adopts Play Framework
Recently Typesafe, the Scala company, announced that the Play framework will be included in the Typesafe Stack 2.0, slated for release in February 2012. The Typesafe Stack is a Scala software platform. The Typesafe Stack combines the Scala programming language, Akka middleware, and developer tools (Scala IDE for Eclipse, sbt, etc.) into a single commercially supported package that is 100% Open Source. At the same time, the Play team announced the beta release of Play framework 2.0. The beta framework supports Scala and its core has been rewritten in Scala. The Play framework is a Rails/Grails like framework originally focused on Java not Scala. Now the Play framework 2.0 supports Scala and Java as first class citizen.
In the press release for this addition to the Typesafe Stack, Guillaume Bort and Martin Odersky share there thoughts of each others creation. "We look forward to working with the Typesafe team to offer developers a powerful new choice when building modern web applications", says Guillaume Bort, Play framework founder. "The Play framework offers an excellent mix of productivity, performance, scalability, and approachability with first class support for both Java and Scala", says Martin Odersky, Chairman and Chief Architect at Typesafe, and creator of Scala. Jonas Boner, CTO of Typesafe, also discussed adding Play to the Typesafe stack .
InfoQ caught up with Donald Fischer, the President and CEO of Typesafe and a former VP at Red Hat, to discuss their choice to adopt the Play framework as well as the decisions for the Play framework to adopt Scala.
InfoQ: What is the Typesafe Stack?
The Typesafe Stack is a modern software platform that makes it simpler for developers to build scalable software applications. It's comprised of the Scala programming language, Akka middleware, and starting with our next release, the Play web framework, along with robust developer tools in a simple package that integrates seamlessly with existing Java infrastructure.
InfoQ: Why are you adding the Play framework to the Typesafe Stack?
Our goal with the Typesafe Stack is to give developers better tools to build software applications at scale. Practically every important large scale application today has some web-facing element to it, often at the very center of the experience. So, we felt it was important to provide a web framework that is well integrated with the other parts of our Stack -- the Scala language and Akka middleware -- and which is compatible with our philosophy of "working hard to keep it simple" by having the platform do more work and the developer do less.
InfoQ: Previously the Play (version 1.x) framework was very Java centric by design and it used Groovy for templating where JSP is typically used and Java for controllers. Scala was more of an add-on or even an after thought to Play framework 1.x. When and why did Scala become such a big part of Play framework 2.0? When will the Play framework 2.0 be released?
The Play framework developers and community started experimenting with Scala in version 1.1. Initially it was accomplished as an external module to the Java-based framework, but increasingly it became apparent that Scala provided fundamentally better capabilities for the Play core, because it helped to handle complex problems without compromising too much on the design front. So, Guillaume Bort and the community decided to move Scala support from a separate module to the core of Play 2.0, which will be designed from the beginning to natively support Scala as a programming language.
InfoQ: When will the Play framework 2.0 be released?
We are targeting February 2012. People who are interested can track our progress at http://www.playframework.org/2.0
InfoQ: Why didn't you add Lift as part of the Typesafe Stack since Lift is very Scala centric and fairly well known?
Play Framework has several attributes that make it a natural fit for the Typesafe Stack. First of all, it has a uniquely accessible developer experience and” feel” that evokes Ruby on Rails, but on the scalable JVM platform. Like Rails, Play follows the well-known MVC (model-view-controller) web application model, which makes it familiar to developers who have worked with other MVC frameworks. Finally, starting with Play 2.0, the framework is deeply integrated with other parts of the Typesafe Stack including Akka middleware and sbt, the simple build tool. That said, Lift and many other popular Scala web frameworks, like Scalatra and Unfiltered, are all good choices depending on the application and developer tastes.
InfoQ: Why is the Typesafe Stack including Play framework 2.0 a better choice than Grails + SpringSource STS or Spring MVC + SpringSource STS?
The Typesafe Stack makes it very easy for organizations to handle complex problems such as large scale web traffic loads, distributed computing, and data processing in such a way that their architecture can scale seamlessly. With the Play framework, developers can take advantage of many modern features: rapid application development, built-in JavasSript "compilation" using Coffeescript and LESS, form helpers, asynchronous processing, actor messaging, data streaming, ORM support. All of these available both to both Scala and Java developers. On top of these, we also provide an Eclipse based Scala plugin and support for the Scala language.
Needless to say SpringSource is a well known name in this space and their offering is also excellent, though it offers different tradeoffs. SpringSource and the Typesafe Stack can also be used in conjunction, for example using the Akka Spring Integration module.
InfoQ: What has been the developer reaction to the Play framework?
We released the first beta of Play 2.0 a few weeks ago. The reaction so far has been overwhelmingly positive.
InfoQ: Is Play Framework 2.0 written in Scala? If so why and how did it go?
Yes, Play 2.0 is mainly written in Scala. But as mentioned above, play provides an excellent Java API as well and that part is implemented in Java. From pure Java developer's point of view, it is really just an implementation detail.
The main reason why Scala was chosen because many concepts were much easier to reason about with Scala. For example, Play implements an idea called reactive programming. This feature allows us to have control when we need it so we don't have to wait for, say an InputStream, to complete, rather we can process data in chunks. This feature makes it possible to write web applications with support for asynchronous processing, comet push and streaming. As another example, Play is using Akka actors to dispatch controller results. While Akka, like Play, has an excellent Java API, it's just much easier and expressive to use it from Scala. Finally, Scala allowed us to compose components in such a clean and easy way by using traits, type classes, pattern matching and partial functions that we could reduce global state to almost zero.
Very good news
The typesafe stack was already very impressive, adding Play makes it a very complete offer.
While we use Spring at work, new projects could be a nice way to introduce some Scala in the mix.
There is already interest in Scala, but this could provide a smooth transition.
Thank you and best of luck.
Tom Gilb & Kai Gilb Jan 26, 2015