Java/GWT 和 Scala/Lift 哪个框架更好?
我想开始一个新的 Web 应用程序项目,但我对 GWT(Java) 或 Lift(Scala) 这两个框架感到困惑。所以我想听听您的意见我选择哪一个?根据我的项目要求,两者都很好。那么根据框架比较,请告诉我哪个好?
I wanted to start a new web application project and I am confused between two frameworks that is GWT(Java) or Lift(Scala). So I want your opinion which one I choose? Both are good according to my project requirement. So on the basis of frameworks comparison please tell me which is good?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我发现 GWT 对于客户端来说是一种极其有效的技术,并且在服务器端结合使用了 Java 和 Scala。
GWT 很有吸引力,因为它允许您从前到后用 Java 编写 Web 应用程序;你用 Java 编写代码;您可以在 Eclipse 中调试程序,从客户端代码无缝地单步执行到服务器端代码,然后再返回。这确实是一件美妙的事情。
Scala 是一门美丽的语言,我和其他人一样爱上了它。如果有一个基于 Scala 的 GWT 变体就好了! 已经朝这个方向做了一些工作。渐渐地,我已经将大部分服务器端代码迁移到了 Scala,这让我非常满意。
如果您要使用 Lift,您需要编写多少 JavaScript 代码?您对 JavaScript 熟悉吗?您的应用程序的客户端行为有多复杂?对于相当直接的客户端逻辑,我确信 Lift 会令人满意。如果您想构建一个非常类似于桌面的应用程序,并且/或者您特别关心从应用程序中榨取最后一点速度,请选择 GWT。不管怎样,你都不会失望的;它们是值得投资的伟大技术。
还要考虑到 IDE 对 Scala 的支持仍处于起步阶段。坦率地说,我认为使用 Scala 可能带来的任何生产力提升都因与 Scala IDE for Eclipse 的各种浪费时间的斗争而消失了。 IDEA 中的故事可能稍微好一些,但也好不了多少。
也许您可以为自己分配固定的时间来探索 Lift 和 GWT,并根据您在这段时间内能够得出的结论做出自己的决定。遵守纪律并遵守您预留的时间范围。
I have found GWT to be an extremely effective technology for the client side, and use a combination of Java and Scala on the server-side.
GWT is attractive because it allows you to write your web application in Java from front to back; you code in Java; and you debug your program in Eclipse, seamlessly stepping from client code to server-side code and back again. It truly is a wonderful thing.
Scala is a beautiful language, and I'm in love with it like everyone else. If only there was a GWT variant based on Scala! Some work has been done in that direction already. Gradually, I've migrated most of my server-side code to Scala, to my great satisfaction.
If you were to use Lift, how much JavaScript coding would you need to do? Are you comfortable with JavaScript? How complex is the client-side behaviour of your application to be? For fairly straight-forward client-side logic, I'm sure that Lift will prove satisfactory. If you want to build a very desktop-like application, and/or you are particularly concerned to squeeze the last drop of speed from your app, go with GWT. Either way, you'll not be disappointed; they are great technologies to invest in.
Consider too that IDE support for Scala is still very nascent. Frankly, I think that any productivity gains that I might have seen from using Scala have been lost on various time-wasting struggles with Scala IDE for Eclipse. The story may be marginally better in IDEA, but not by much.
Perhaps you might allocate yourself a fixed amount of time to exploring Lift and GWT, and make your own decision based on what you are able to conclude in that time. Be disciplined and stick to the time box you've set aside.
不要忘记您还可以将 GWT 与 Scala 一起使用(Scala 上的服务器端代码和 Java 上的客户端代码)。
这些组合最擅长的方面也存在一些差异。例如,Lift 有 uber comet 支持,而 GWT 更适合富裕的客户端,并且可以减少服务器请求的数量。
我会选择 Lift,除非您需要真正丰富的客户端或巨大的可扩展性(例如,没有会话、大量客户端缓存等)。
Don't forget you can also use GWT with Scala (server side code on Scala and client side on Java).
There is also some difference in what these combos are best at. For example, Lift has uber comet support and GWT is better for richer clients and can reduce number of server requests.
I'd chose Lift unless you need really rich client side or enormous scalability (e.g. no sessions, lots of client caching etc).
就我个人而言,我建议Lift。但这纯粹是人为驱动的建议,与两个框架的相对技术优点无关。
事实上,您甚至知道要问这个问题,这表明您已经了解 Scala,喜欢它,并且可能想进一步使用该语言。在这种情况下,如果您被迫用 Java 编写应用程序,我想您很快就会感到沮丧。
尽管 Scala可以与 GWT 一起使用,但您会发现 Lift 对 Scala 的一些更好的功能(即 actor)有更好的支持。因此,出于这个原因,我更倾向于Lift。
您可能还想研究 Scalatra 和 Play 作为 Scala 的替代 Web 框架。
Personally, I'd advise Lift. But it's a purely human-driven recommendation and nothing to do with the relative technical merits of the two frameworks.
The fact that you even know to ask this question suggests that you already know Scala, like it, and probably want to use the language further. In this case, if you were constrained to then write an application in Java, I imagine you'd get quickly frustrated.
Although Scala can be used with GWT, you'll find that Lift has much better support for some of Scala's nicer features (i.e. actors). So for this reason I'd favour Lift.
You might also want to investigate Scalatra and Play as alternative web frameworks for Scala.
它们都生成一个网络应用程序,但本质上是不同的框架,所以我不知道如何比较它们。当你说“好”时,你心中的标准是什么?
编辑:
可扩展性和性能取决于事务和数据后端的类型,但在所有条件相同的情况下,您使用 Lift/Scala 的机会会更大。
来自@dpp 的采访:
They both produce a web app, but are different frameworks in nature, so I don't see how they can be compared. When you say "good," what criteria do you have in mind?
Edit:
Scalability and performance depends on the type of transactions and data backend, but all things equal, you'd have better chance with Lift/Scala.
From @dpp's interview:
我自己即将开始一个 Web UI 项目,所以我发现这个线程非常有用。我知道原来的帖子是为了比较 GWT 与 Lift 各自的优点,但您可能也有兴趣查看 Vaadin (http://vaadin.com/home)。它使用GWT在浏览器中进行渲染,但大部分UI结构和逻辑是在服务器端实现的。服务器端代码可以用任何 JVM 语言实现(因此您可以使用 Scala)。因此,如果您是 Scala 粉丝,这可能是适合您的解决方案。
I am about to embark on a Web UI project myself, so I found this thread to be very useful. I know that the original post was meant to compare the respective merits of GWT vs Lift, but you might also be interested in looking at Vaadin (http://vaadin.com/home). It uses GWT for rendering in the browser, but most of the UI structure and logic is implemented on the server side. The server side code can be implemented in any JVM languages (so therefore you can use Scala). So if you are a Scala fan this could be a suitable solution for you.