Why I'm Moving Away from the Play Framework
whilefalse.blogspot.com
whilefalse.blogspot.com
I'm finding some things are a bit awkward, particularly around templates and routing. Also, the documentation while good is lacking in other parts.
Play is a very prescriptive framework but only on a couple of choices do I have an issue.
The first is about transactions. Each HTTP request is a transaction. Generally I'm fine with this but you need a way to override or control this (IMHO).
Second, I like the mixin approach with controllers (@With(...)). I wish there were something similar with models.
Third, and this is the biggest, it doesn't integrate with Maven, which is something I'm very tempted to fork it for. There's no reason it can't be a Maven plugin/archetype, use Maven for dependencies (directly, rather than tortuous syntax in dependencies.yml), etc. Some guy has an alpha version of something like this already when I last looked.
Fourth, while I don't necessarily mind that controllers are static (as a way of indicating they're stateless it seems), that's actually an issue for parallellizing tests.
Play 2.0 is moving even further away from this and using SBT, which I've never used but heard mixed things about.
I can't speak to many of the specifics of this post (eg I only use Play on Linux).
Whatever (valid) criticisms you can level against Play I'd still far and away prefer to use it over any other Java Web framework I have used or know about.
I'm also a fan of maven. There's nothing better than checking out a huge project with a great deal of dependencies and just have it build perfectly with a couple of keystrokes.
Seems like the play developers (Guillaume et co) went for a clean break with legacy java though. And if you want that, you can't depend on maven.
Only had a cursory look at 2.0 so far, but moving further into Scala territory and adopting SBT seems like an interesting move to me. Play is becoming a great vehicle for Web developers who want to ease into a Scala future.
- We have had a fine experience not using Play's ORM support at all -- we have a Plugin that handles transactions for us, and we use non-Play-integrated persistence. It still works great.
- All of the Controller member variables are ThreadLocals, which is how Play handles concurrency. It seems like multi-threaded tests should work just as multi-threaded requests do. I'm curious what problem you're having with parallelizing tests?
Buildr is a welcome improvement, at least there is no XML on sight.
I like Play overall but two things concern me, both related: 1) they are moving toward Scala and 2) they are adopting sbt.
This looks to me more like a "picking a shiny toy" move than something that is being done to benefit users (Scala is still quite a marginal language and sbt is very controversial, even among Scala enthusiasts).
While I understand they need a web framework in their stack, and Play is more RoR-ish than Lift (which makes it more marketable I think), I dunno, some of the gymnastics Play 1.x used to pull off its magic seemed a little over the top to me.
Like using bytecode rewriting to add language-level features like properties. Yes, Java sucks, but we who use it understand that and accept its imperfections. I'd rather fix Java proper (or use Scala) than have a web framework think that it's their job to somehow fix a lackluster language.
Just seems like it'd lead to a lot of bloat/code in the framework that isn't "just serve this webapp as simply as possible".
That being said, what Play got right did look really awesome (the compilation error reporting in particular).
Anyway, will be interesting to see what the Play 2.x release will look like, given it looks like Typesafe is having some amount of involvement in it?
All too familiar if you use Eclipse :)
Fair enough, but I wouldn't switch to an inferior framework over it.
After having seen their video, I have to say that the Play! framework folks seem very insightful in their design goals. They hit the nail right on the head in terms of the major usability problems of most Java Web AppServer software.
What makes or breaks great software is community and culture.
I'd still only choose it if I had to use Java though.
If you can roll with Django you can roll with Play. Although, I always prefer a python microframework such as flask nowadays.
I also see how Play is now part of typesafe, so that could get better or worse, but it is the right direction for Java web apps to go.
The lightweight nature of Play combined with the speed of the jvm (compared to Python), static typing and IDE support, makes it a winner in my book. I like vim, but wherever I click in a Play project (including in routes, property files and templates), I always end up where I need to be.
The author wrote the Play Framework Cookbook and so it's a presentation from someone that can be considered a bit of an authority on Play (and not someone with an axe to grind). However, the presentation covers a bit of what worries me about Play. Play rewrites the bytecode for things like emulating properties and allowing you to pass whatever you want to the templates and have it automatically name the variables based on their local names in the calling method.
For me, the reason to use Java over Python or Ruby would be to move away from some of the behavior used in those languages that can make debugging and static analysis harder.
I've used Play for some hobby stuff (and kept up on Play 2.0). Play 2.0 seems to remove the former system for passing variables to the templates in favor of a system where templates accept certain parameters with types (a welcome change for me). However, at least the last time I played with it, Eclipse couldn't tell me what variables and types the template was expecting.
I guess Play leaves me feeling like it brings the magic to me without as much ease that Python and Ruby offer (or, at least, without as much familiarity). That might be changing - I think that the changes in the templating for 2.0 show a clear move in that direction. I really wish them well since it's always good to have more good options for development and there's a lot of Java already out there to leverage.
I maybe be misunderstanding her first point, but I am currently running individual unit tests in IntelliJ for one of my play apps on 1.2.4...
I can't speak to her other issues, I've never run in to them.
For what it's worth, I've been developing a Play (now 1.2.4) app for a year now and it's been a blast. Sometimes you can see the framework's immaturity, but I haven't run into any showstoppers like the author.
He does bring up the point that Play 1.X is essentially out to pasture at this point. Thats not to say typesafe can't come back and once 2.0 is settled and fix the outstanding bugs , but as far as the community is concerned most have moved on to 2.0 or are aren't experiencing these issues.
For my part I have never ran into any serious bugs on my Play apps and services. I would note that I don't have any very large scale deployment, mostly just internal applications. I am however using Play 2.0 as the foundation for my next big project and so far even the RC have proven stable and functional.
s/his/her/
That's focused on RESTful services so presumably also a JS templating tool browser-side or similar.
From the post I understood that she was pissed because they did not accept her fix on testing the app from the IDE.
The second point was that there is a bug in the framework that they could not find... it seems though as the bug is in their application. (concurrent modification of a Map is a problem in java not Play!)
It's a pity to give up such a great framework for silly reasons.
Every time I have to switch to another framework (especially jsf) I want to shoot myself.
Anyway... good luck finding another good java framework.
I also think Lift is dead. The creator of the project left, the documentation isn't great, View first model isn't popular, very little activity in #lift, very little activity in the lift framework google group. Not good signs.
Yeah that's an interesting tradeoff. I like it because it helps keep code completely out of the html templates, which is a design goal of lift. I tend to work with designers who do HTML/CSS only, not javascript, and I do the backend Scala and frontend Javascript, so that separation of roles works. But if your dev team (as most big ones do) consists of frontend HMTL/CSS designers, frontend Javascript UX devs, and backend devs, then that architecture may not be optimal.
> I also think Lift is dead.
Far from it.
> The creator of the project left
Not exactly:
1. He's still a core committer,
2. Advised the founders of Lift Co. [1] - commercial support/SLA for lift projects,
3. Is active on the Lift group [2] (the activity takes place there and at Assembla [3], not Twitter)
4. Continues to present about [4], blog about [5][6], and advocate Lift [7].
5. Even holds personal office hours every week in San Francisco to support Lift devs, for free. He's just not doing direct commercial consulting on Lift anymore, others have grabbed that torch and are running with it, primarily in SF, London, and India.
> the documentation isn't great,
True, but improving. The new book from Manning, Lift In Action [8] is excellent. You can buy it from Manning, or obtain it by other means. There are completely free options as well [9].
> View first model isn't popular
Popular is not necessarily better [10], unfortunately. However, if you grok view first and still believe MVC is better, Lift also includes an MVC version [11] for you.
> very little activity in #lift,
The meat of the discussion is on the google group [2], not Twitter. (And it's #liftweb anyway, but admittedly not much difference there either).
> very little activity in the lift framework google group.
Maybe you're comparing to a mega project like Rails, or maybe you accidentally mistook the stickies at the top for the actual group activity, but there's more than 'very little activity' in the group.
Granted, Lift isn't without issues. Getting started via Maven is painful (Pro-tip: use SBT + Lifty [12]). It has a non-trivial learning curve (I actually had to learn Haskell in order to grok Scala in order to use Lift - all worth it - though people coming from the ML family may have an easier ramp-up); has to deal with Scala's versioning and dependency issues (which David Pollack ticked off the Scala community by vocally complaining about, and which SBT does a decent job of mitigating), and does most things differently than the norm.
However, it's a superb piece of technology more than worth the effort to learn. It's more inherently secure than any other framework out there, enables a simple architecture (3-tier only, web/app/db, no caching layers), is relatively easily scalable (just add more instances to whichever layer you need to scale), does Ajax and Comet better than anything else, is very productive once you know it (minimal code, no testing necessary for classes of errors the type system or compiler catch), and lots of other excellent stuff [13].
It's evolving, maybe not at the pace of Rails, but it's starting with a far stronger technical architecture, runtime, and Java ecosystem interopability.
-----------------------
2. http://groups.google.com/forum/?fromgroups#!forum/liftweb
3. http://assembla.com/wiki/show/liftweb/
4. http://www.infoq.com/presentations/Exploring-Composition-and...
7. http://visi.io/ (see comments on Lift)
8. http://manning.com/perrett/
9. http://www.assembla.com/spaces/liftweb/wiki/Resources; http://richard.dallaway.com/lift-cookbook-an-introduction
10. https://www.assembla.com/wiki/show/liftweb/View_First
11. http://www.assembla.com/spaces/liftweb/wiki/MVC_(if_you_real...
12. https://github.com/harrah/xsbt; https://github.com/Lifty/lifty
I can't speak to 2.x.
http://www.playframework.org/documentation/1.0/templates#Act... and http://www.playframework.org/documentation/1.0/routes#revers...
Are there other play-like frameworks for java?
http://www.stripesframework.org/
http://sourceforge.net/projects/stripes/
And by '...frameworks for java', do you mean Java specifically, or any JVM language. Several good options for the latter.
EDIT: Author of the blog post.
EDIT: I am also referring to the poster. I'm a fan of Play and echo many of the sentiments others are listing out.
A concurrent hashmap is only safe in regards to its own internals, however if you're operating with keys and values that are not thread-safe, then it can still deadlock on get() or other operations. This is why this model of threading is hard, because it is not composable.
Also, threadsafe data-structures have terrible performance characteristics, unless the implementation is lockfree, and lockfree implementations are hard to get right. Therefore I don't blame devs that use HashMaps, as sometimes is better to put locks in other places, or to make sure that the variables are local to a thread.
Threading is hard, lets go shopping.
I think blaming someone for using a non-thread-safe data structure without sufficient explicit locking is justifiable.
I hope this is a joke. I know plenty of very good Java programmers, but only one or two that I would ever trust to write a concurrent hash map class that matched java.util.concurrent.ConcurrentHashMap's functionality (to say nothing of performance), let alone improve on it.
It's a nasty chunk of code, it's not a simple matter to get this right: http://www.docjar.com/html/api/java/util/concurrent/Concurre...
But the disparity between what web frameworks actually do for me in any particular application and the amount of layers and dependencies they introduce boggles my mind.
[Edit] If you use maven try mvn dependency:tree
Just one experience fwiw. Sure, it's still a framework.
OP is looking for a silver bullet and there ain't one. Play! is an open source project, so the developers didn't have time to deal with his patch and he got upset. People forgot OS devs don't get paid for their work. Be a little bit more appreciative.
Google App Engine cause we hate doing sysadmin work. Objectify. Cambridge Template Engine with JEXL. RestEasy/HtmlEasy. Jackson. Guice to bind it all together. Front end is heavily CoffeeScript, Handlebars, Jquery, LabJS, customized bootstrap and various other libraries. We've got a credits page full of links to the above projects... https://www.voo.st/about#credits
Overall, I'm pretty happy with this choice. We've had to do some weird and semi-complicated stuff to integrate it all together, but at this point, it works quite well.
Used Play for a few projects, but don't like that 2.0 is more or less getting rewritten... don't like Spring... not sure what is left (JEE6 and JSF2? God I don't want to use JSF again unless it changed significantly)
Somehow I managed to use Wicket for well over a year before realizing the benefit to this approach.
Host on Glassfish v2.
Of course, GWT is not perfect. DevMode needs to be faster, and they need to integrate scala-gwt. :-)
I wrote a Backbone-like framework to deal with some of the boilerplate (http://www.tessell.org), especially if you're doing MVP. I don't quite have a solid DTO story down yet, but overall I like it.
If I had to use a server-side framework again, I really liked Click (http://click.apache.org), as it is component based, but has source code you can actually read (vs. both Tapestry and Wicket which are too big/magical IMHO).
I've never really understood why Stripes hasn't "caught on." It's simplicity is wonderful.
Most of the history of Java web frameworks focused on ways to make form processing easier. Nobody (sane) does html form processing anymore. The "framework" needs to be little more than a way to render html templates and an rpc mechanism.
For MVC type (like ASP.NET MVC not Rails): SpringMVC
For ASP.NET type: JSF 2.0 (I heard they simplify it greatly)