This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Tony Hsieh wrote:I was confused with first using Play (2.0) for Scala (though I admit I was trying to learn Scala at the same time) so I have gone back and focused on learning the language first.
Now after the Coursera class, I'm slightly better armed to take on Play - at least syntax-wise.
I now hear about Scalatra as a simpler-to-grok framework.
With so many things to learn and so little time, what is the difference between the two frameworks?
Is Play for Scala harder to learn but ready for industrial strength site and Scalatra simpler to learn but more for less scaling "toy" sites?
Any thoughts would be great!
Note upfront: I don't have any experience with Scalatra, so the remainder of this post is guesswork ;)
I think the main difference is that Play is more of a full-stack solution, with a bunch of built-in or at least recommended components, while Scalatra provides only a core and relies on you choosing the third party libraries of your liking for many tasks.
I don't think that any of the frameworks is particularly harder to learn.
Given that Scalatra has a very similar architecture, I think it will scale just as well as Play, and it's certainly not just for simpler or toy sites.
I know that you believe you understand what you think I said, but I'm not sure you realize that what you heard is not what I meant.
Joined: Feb 05, 2013
Thanks for your reply, Erik!
I bought your book as a direct response after flailing with Play. I'm going to use my willpower to work through your Play for Scala book before I switch over to something else like Scalatra.
Hi, I'm chipping in late here, but I have a few things to add to what Erik said (all of which I agree with by the way).
First, it's important to say that there are quite a few similarities. Obviously, both promote Scala as a first-class language. Both have books available, e.g. there's Play for Scala and Scalatra in Action. Both frameworks are fast, with Scalatra probably having a speed edge in (mostly meaningless) benchmarks. Both are routinely used by very large organizations that want to scale massively.
The most obvious difference between the two frameworks, as Erik said, is that Play! is a much more full-stack framework, and does a lot more convention-over-configuration for you - so it provides convenience with the trade-off that it makes more assumptions about your application's setup.
In contrast, Scalatra tries to provide a very small set of core routing functionality and then let you easily layer whatever other libraries you want on top. In our view (I'm a Scalatra contributor), this is good thing as it gives you more freedom to structure things the way you want. I like Scalatra because it makes it easy to write multiple small applications with well-defined purposes.
There is another difference which may be somewhat less obvious but is still very important: deployment.
Play! is usually deployed using Netty (I am not sure of the status of its external WAR plugin at this point, maybe somebody else can comment on that). Scalatra only deploys on regular servlet containers (Tomcat/JBoss/Jetty/whatever), so if you need to deploy your app that way, it might make a difference to you. Each has its advantages and disadvantages.