简体   繁体   English

Playframework和Django

[英]Playframework and Django

I have worked with Django before and have recently seen the Play framework . 我之前和Django合作过,最近看过 Play框架

Is this the Java community's answer to Django? 这是Java社区对Django的回答吗? Any experiences with it? 有任何经验吗? Any performance comparisons with other Java web frameworks? 是否与其他Java Web框架进行了性能比较?

Edit:Almost similar to this question , the responses, unfortunately don't say much about the framework. 编辑:几乎与这个问题类似,答案,遗憾的是没有多说这个框架。

Play! 玩! is a breath of fresh air into Java and bypasses all the Enterprise cruft that has evolved over the years. 为Java带来了新鲜空气,绕过了多年来发展起来的所有企业。 Even the namespace is just play not com.playframework. 即使是名称空间也只是播放而不是com.playframework。 It is supposed to be an answer to Rails, Django etc and is MVC based. 它应该是Rails,Django等的答案,并且是基于MVC的。 It is needed for Java to stay relevant in all but deep entrenched enterprise shops. Java需要在除了根深蒂固的企业商店之外保持相关性。

Play! 玩! reduces the overabstraction and painful configuration of old Java. 减少了旧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). 它是一个完整的堆栈,它不依赖于或者像Restlet尝试的那样使用旧的Servlet / EJB方法(在Servlet中使REST变得更容易)。 Play! 玩! is a great REST based Java framework that is a valid contender to other platforms MVC frameworks. 是一个很好的基于REST的Java框架,它是其他平台MVC框架的有效竞争者。

It is very RESTful and it is easy to bind a parameter to a java method. 它非常RESTful,并且很容易将参数绑定到java方法。 They have also made JPA much easier to use through their play namespace. 他们还通过play命名空间使JPA更容易使用。

play.db.jpa.Model 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. Python用于编写脚本,而不是使用Maven构建,这可能会挽救一些生命。

I haven't been this excited about a Java framework since Red5 or Restlet. 自Red5或Restlet以来,我对Java框架并不感兴趣。 A bonus is they have easy ways to get your app up on Google AppEngine as well using the Java version of GAE. 奖励是他们可以使用Java版GAE轻松地在Google AppEngine上启动您的应用。

I have been using Play! 我一直在玩Play! now for a few months and in fact have come to love the framework. 现在已经好几个月了,实际上已经开始喜欢这个框架了。 I struggled with Rails and Django a bit, mostly because I am really not a fan of dynamically-typed languages; 我有点挣扎Rails和Django,主要是因为我真的不喜欢动态类型的语言; however, there was never a really good web development framework for Java to compete with these. 但是,从来没有一个非常好的Java开发框架可以与Java竞争。 In terms of productivity, Rails and Django were the leaders for the MVC arms race that was going on. 在生产力方面,Rails和Django是正在进行的MVC军备竞赛的领导者。 Play! 玩! is awesome, it's concise, scalable, powerful, and it has a great community that is growing all the time. 它非常棒,简洁,可扩展,功能强大,而且它拥有一个不断发展壮大的社区。 If you're still really into using a language like a Python or Ruby, you can use Play! 如果您仍然使用像Python或Ruby这样的语言,可以使用Play! with Scala too. 还有Scala。 I am really trying to get into Scala right now because I think it has a great future and it's a lot of fun to use. 我现在真的想进入Scala,因为我认为它有一个美好的未来,并且它使用起来很有趣。 Anyway, I would recommend giving it a try! 无论如何,我建议尝试一下!

The Play! 表演! framework is a really good piece of software, and that the JavaEE bloated environment should be inspired from. 框架是一个非常好的软件,JavaEE臃肿的环境应该受到启发。

I moved from Java -> Django because of the fast cycle "modify file" / "reload browser", and the Play! 由于快速循环“修改文件”/“重新加载浏览器”和Play,我从Java - > Django转移了! framework makes me came back to my favorite Java language. 框架让我回到了我最喜欢的Java语言。

It could also be compared in some terms to what Grails and in general dynamic languages in Java (Groovy is used in Play!) are trying to import: simplicity, speed and reliability. 它也可以在某些方面与Grails和Java中的一般动态语言(Play中使用Groovy)试图导入的内容进行比较:简单性,速度和可靠性。

I am also a Django user. 我也是Django用户。 I've just visited the Play framework and skim thorugh its documentation. 我刚刚访问了Play框架并浏览了它的文档。 It has the simplistic design Django has been known of. 它具有Django众所周知的简单设计。 It even has app engine support built-in. 它甚至内置了app引擎支持。 I'm sure many java developers will support it, and it only need some time to see cool plugins from the community. 我相信很多java开发人员都会支持它,只需要一些时间就可以看到来自社区的酷插件。

We recently started using Play for building a webservice for various mobile applications. 我们最近开始使用Play为各种移动应用程序构建Web服务。 I come from a Java environment. 我来自Java环境。 I can tell you that the learning curve isn't all that steep--literally in an hour I had the webservice running with basic API already. 我可以告诉你,学习曲线并不是那么陡峭 - 实际上在一个小时内我已经使用基本API运行web服务了。 One week later we were on Amazon Web Services. 一周后,我们使用的是亚马逊网络服务。 I definitely see a future for Play as it simplifies web development for Java developers. 我确实看到了Play的未来,因为它简化了Java开发人员的Web开发。

Couple of things that I noticed however (asset versioning, etc.) still are not built into the framework, but i'm sure they'll be there in time. 然而,我注意到的一些事情(资产版本控制等)仍未构建到框架中,但我确信它们会及时存在。 I would say it is definitely worth a shot using Play. 我会说使用Play绝对值得一试。

I come from a very strong java background. 我来自一个非常强大的java背景。 So my answer here could be a little biased. 所以我的回答可能有点偏颇。

Play finally brings to the java community what django has been for all these years in the python community, but just a way better. Play终于为java社区带来了django多年来在python社区中所做的一切,但只是更好的方式。 Play is built on the jvm therefore inheritance all the goodies from a solid platform that has been proving over the years to be the most reliable and scalable one that allows to write and run applications at scale. Play是建立在jvm之上的,因此从一个可靠的平台继承了所有的好东西,这个平台多年来一直被证明是最可靠和可扩展的,允许大规模编写和运行应用程序。

I want to say that I did try django. 我想说我尝试过django。 Its popularity among the web community made me curios and I wanted to give it a try. 它在网络社区中的受欢迎程度让我很好玩,我想尝试一下。

Strangely I did not find it as easy to use as I had expected. 奇怪的是,我没有发现它像我预期的那样容易使用。 So many configurations. 这么多配置。 Too may libraries doing the same thing and often not play very well with each other. 图书馆也可以做同样的事情而且往往不能很好地相互配合。 A way too much magic. 一种太多魔法的方式。 Furthermore, not having type safety makes very hard to manage and maintain web application at big scale. 此外,没有类型安全性使得很难大规模地管理和维护Web应用程序。 Don't get me wrong, I am pretty sure that people managed to do it, but in my experience I still find java/scala best suited for this, especially when you share the code base with a lot of other developers. 不要误会我的意思,我很确定人们设法做到了,但根据我的经验,我仍然发现最适合这种情况的java / scala,特别是当你与很多其他开发人员共享代码库时。

IDE support for Java it is unbeatable. IDE支持Java是无与伦比的。 If you implement TDD you will find yourself refactoring code and moving things around on the daily basis. 如果你实施TDD,你会发现自己在每天重构代码并移动东西。 And java IDEs give you all this power. java IDE为您提供所有这些功能。 With type safety and more. 具有类型安全性等。

My take away is that as long as you find yourself writing a simple CRUD application/prototype/toy without even thinking too much of advanced features and big scale then you can probably find some advantages on using python/django. 我的看法是,只要您发现自己编写一个简单的CRUD应用程序/原型/玩具,甚至没有考虑过多的高级功能和大规模,那么您可能会发现使用python / django有一些优势。 Otherwise the whole java ecosystem wins hands down. 否则整个java生态系统都会失败。 And play is the cherry on top. 而且游戏是最重要的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM