Playframework and Django

n002213f picture n002213f · Nov 10, 2009 · Viewed 13.6k times · Source

I have worked with Django before and have recently seen the Play framework.

Is this the Java community's answer to Django? Any experiences with it? Any performance comparisons with other Java web frameworks?

Edit:Almost similar to this question, the responses, unfortunately don't say much about the framework.

Answer

Ryan Christensen picture Ryan Christensen · Nov 13, 2009

Play! is a breath of fresh air into Java and bypasses all the Enterprise cruft that has evolved over the years. Even the namespace is just play not com.playframework. It is supposed to be an answer to Rails, Django etc and is MVC based. It is needed for Java to stay relevant in all but deep entrenched enterprise shops.

Play! reduces the overabstraction and painful configuration of old Java. It is a complete stack it does not rely or play to the old Servlet/EJB methodology like Restlet tried to do (making REST easier in Servlets). Play! is a great REST based Java framework that is a valid contender to other platforms MVC frameworks.

It is very RESTful and it is easy to bind a parameter to a java method. They have also made JPA much easier to use through their play namespace.

play.db.jpa.Model

public void messages(int page) {
    User connectedUser = User.find("byEmail", connected());
    List<Message> messages = Message.find(
        "user = ? and read = false order by date desc",
        connectedUser
    ).from(page * 10).fetch(10);
    render(connectedUser, messages);
}

Python is used for scripting instead of builds with Maven which might save a few lives.

I haven't been this excited about a Java framework since Red5 or Restlet. A bonus is they have easy ways to get your app up on Google AppEngine as well using the Java version of GAE.