We're using Play pretty heavily at our startup though not for our customer-facing frontend, that's still in Rails.
What we love about Play:
* Async everything, especially the web service library
* JSON macros
* Scala-based templates
* Integration with Akka
* Support for server-sent events (we use this for cluster monitoring)
What we wish was better:
* JSON deserialization performance isn't as good as raw Jackson yet. (Our PR regarding this is actually in 2.2, should be better now)
* Documentation could be much better, we still have to resort to the API to figure out a lot of stuff
I've been using Play ever since the 2.0-RC days and it's definitely made some huge gains since then. We use Akka very heavily, especially its clustering, and Play works well in conjunction with that though there are still some gotchas lurking about.
Our backend is one big Akka cluster right now. We've had a few hiccups but overall it's been a hugely enjoyable experience.
Fully agreed on a most of this; when Play does something well, it does something really well. I personally just wish the build system wasn't such a mess and so antithetical to good development practices--it's extremely hard to have something like a shared domain library among multiple projects (with hot reloading, i.e. if you need to iterate on it while you develop) without making a fake Play project with a conf directory and all of that. It feels built for independent systems/applications rather than ones that play (ha) nicely with each other.
(Also, using the Flyway module has made life a lot easier. play-evolutions is a bit wonky.)
Play 2.0+ is based on SBT as build system. SBT uses ivy and maven repos as source for dependency lookup. Maven repo's often show the SBT mantra form of a maven dependency. F.i. click on the sbt tab here http://mvnrepository.com/artifact/org.eclipse.mylyn.github/o...
If you don't want to add your dependency to a maven repo you can define a sub-project. SBT projects are aggregated recursively of other sbt projects.
My pet peeve is that SBT suffers from ungoogleable scalaz like operators like %% instead of %. And that the Scala IDE doesn't provide any help like code completion, marking compilation errors e.d. in creating your project/Build.scala
Those two facts make sbt a big hurdle in adoption I noticed.
Believe me, I've spent enough time with Play to know exactly how the build system does its thing with external dependencies.
The problem I'm referring to is that, for a long time at least (I know pre-2.1, maybe 2.1 as well), there was no way to aggregate non-Play projects--that is, ones that didn't have a conf directory and did have their own pom.xml or whatever--and use the recompiler. So if you were trying to build your project using an external Java/Scala domain object library that could be shared between projects and wanted it to hot-recompile while you're working (because I at least don't write every model class before I get going) you were in for a world of hurt.
I must be misunderstanding the question. Aggregation of non-PLAY sbt projects has worked from day one of Play 2.0 AFAIK. (That's when I started using both, and we've had sbt projects as bit submodules compiled as dependencies from the start).
Yeah, maybe we're talking about different things; I may be using the wrong sbt terminology because I generally try to avoid it. =) Here's the original bug where some WTFs were exchanged:
Ben's patch made the workaround less terrible for 2.1, but it's still a really weird hacky thing to me and I never got it working with my Maven projects (my preferred backend uses Dropwizard so using a sbt project wasn't really optimal at the time).
This ticket is (justifiably IMO) marked as invalid. It's not a bug, misfeature or anything. It looks like a misunderstanding honestly.
If you approach it with a "Play first" mindset and ignore that any of the Play build-cycle stuff only works because it's built on SBT it's going to be rough going.
An "SBT first" mindset makes it much easier.
Create three console apps in three different folders. Doesn't matter where on your system these live.
Now create a fourth directory, add a project sub-folder and a `Build.scala`. Aggregate the projects together and make Project-C a dependency of Projects A and B. A and B are otherwise completely unrelated.
Now when you drop into the SBT console you can run test, compile, etc. All your standard aggregation tasks. If you wanted to actually run A or B, you can run the `run` task and it'll ask you what main-class to execute.
Here's the only real difference as far as Play is concerned: It doesn't use the standard SBT `run` task. So to get the `run` task from the Play plugin you first need to select your Play sub-project: `project my-play-project`. Now you can run `run` and it'll work like a normal Play application.
I think that extra step is actually resolved in Play 2.2 (it uses the standard `run` task now I've heard).
In this setup your "root project" isn't your Play app. It's a code-less project just defining the build and dependencies between your projects. You could add your common project to the Play app's Build.scala, and use `file()` in the Project declaration for it. The project can live anywhere. It's not at all necessary it be in a sub-path, use symlinks, anything like that.
In SBT 0.13 it's even better since you can do almost everything in .sbt files, which unlike a Build.scala can be built up across several projects. So Play-App-A can read the build.sbt from ../common/build.sbt and use that. Where a Build.scala has to be all-encompasing, so your common project configuration would have to reside in my-play-project-a/project/Build.scala.
SBT really is very nice. :-) I've used Maven, Bundler, Buildr, etc. Written my own JRuby Maven+Rubygems build tool (http://github.com/sam/doubleshot). The docs for SBT are real heavy, but if you set aside a few hours to watch some presentations on Parleys, Youtube, etc, it's pretty easy to get into.
Feel free to ping me if you're interested and could use a hand.
This is true, although I'd replace "multiple projects" with "multiple applications" as you can most definitely create highly modular applications using SBT sub projects.
The dirty *nix hack for this is to symlink the shared library; otherwise, converting the lib to a plugin is one way toward creating reusable cross-application libraries.
What I never understood is why they embrace rendering templates at the server. Is it simply a matter of "because we can and it's nice for the people that want to use it", or is there a real real reason why pushing raw HTML via AJAX request is better?
I always thought the status quo in the web development world was to use a framework like Backbone.JS to communicate with your backend and use a client-side template engine to render the templates.
We push HTML through AJAX to keep all of our templating centralized and consistent.
For a while we used templates for the container page, and then backbone and js templating for certain elements on the page. It can become the 2013 equivalent of spaghetti code if you're not careful.
Now, with HTML via AJAX, you have a clear separation of concerns. For example: the designer doesn't need a dev to make an HTML change, and the dev knows that there will be one place that controls how pages are rendered.
Definitely not status quo. One big example is when Twitter moved away from that back to server side rendering for performance reasons [1].
There are basically three aspects of website performance - server performance, network performance, and client performance. You can control server performance and network latency (CDN), but you can't control what's going on on your users computers.
For example, if they're tab-abusers (guilty as charged) with 50+ non-trivial tabs open, plus other apps open and stuff running in the background, then your beautiful high-performance UI could start chugging (as many do on my abused laptop).
So you really have to think about what your main userbase will be and whether you need to put the rendering chunk of your app's CPU usage on your own servers or on your client's desktops/laptops/tablets/phones.
If you have an application that doesn't need to be indexed by search engines, yes. If you have a content heavy website the preferable method is still to render templates on the server. It still varies depending on your use case. I wouldn't say that is the status quo at all.
We use the templates to render email messages on the server primarily.
Note that Play doesn't force you to use the templates, you can plug in your own very easily or forgo them entirely and just push JSON out for client-side rendering.
We use that for monitoring our backend Akka cluster: Play streams JSON using server-sent events to the client for rendering Mustache.js templates.
I don't know the exact motivation for including compiled templates (we love them) but in practice Play is perfectly happy either way.
It's optional; nothing forces you to use them vs doing the AJAX du jour.
Play templates are particularly speedy though, they get compiled into JVM bytecode. I actually prefer doing things that way and keeping markup and JS to a minimum. It 'feels' faster and more robust to me.
Also using Play at a start-up, but as a customer-facing web app. It's great for productivity - getting both compile- and runtime errors in the browser kind of means that you have the advantages of Scala/statically-typed languages combined with those of dynamically typed languages. If you're ready to go fully stateless and (mostly) asynchronous/non-blocking, this is the framework for you.
I agree that documentation is still lackluster. I would add that although I love the Scala templates, the support for html forms in Scala is a bit clunky. Also there are still a few too many changes requiring code refactoring on minor releases, but I accept those as a byproduct of quick iterations/improvements.
Play 2.0 comes with Netty[1] built into it for making asynchronous requests, websockets and REST easier to handle. Netty is what replaces Tomcat unless you choose to use a third party plugin that builds your Play 2.0 website as a WAR file. Also, with Netty, it builds the entire site into a self contained module that you can run with one click anywhere you have the JVM installed (and the dependencies such as the DB if not using the built in H2). I found it useful for quick presentations or portability.
Play is a web development framework. It has the capability to run standalone using it's built in http server or it can output a .WAR file that can be run under containers like Tomcat.
and play 2.1+ can serve https as well http://www.playframework.com/documentation/2.2.x/Configuring.... In practice, play instances are behind a front end server such as nginx for load balancing, https, caching, and virtual hosting. Play's convention for stateless sessions makes it really attractive to scale by adding more instances to the node balancer.
No, it's mostly replacement for the spring-web/struts/jersey/etc. layer (though it also has its own templating layer to replace JSP or whaever). You can run it under tomcat if you want to.
Why use a Rails / Play hybrid? I can understand separating the front- and back-ends, but why not stick to one platform through and through? Momentum? Expertise? Marketing?
The founders wrote the frontend in Rails before I came on board but it does very little work. Really it just handles authentication and captures OAuth tokens.
I imagine we'll move it to Play eventually but right now we're focused on the backend (Play/Akka) because that's where everything really happens.
What we love about Play:
* Async everything, especially the web service library
* JSON macros
* Scala-based templates
* Integration with Akka
* Support for server-sent events (we use this for cluster monitoring)
What we wish was better:
* JSON deserialization performance isn't as good as raw Jackson yet. (Our PR regarding this is actually in 2.2, should be better now)
* Documentation could be much better, we still have to resort to the API to figure out a lot of stuff
I've been using Play ever since the 2.0-RC days and it's definitely made some huge gains since then. We use Akka very heavily, especially its clustering, and Play works well in conjunction with that though there are still some gotchas lurking about.
Our backend is one big Akka cluster right now. We've had a few hiccups but overall it's been a hugely enjoyable experience.