java GWT 与 Flex 对比?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/424895/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
GWT vs Flex vs?
提问by Limbic System
My company is trying to migrate away from a .NETapplication to something that is purely web-based, and very "ajaxy". The original .NET app is fairly interactive, roughly equivalent to Google Maps as far as user interaction is concerned (zoom, pan, annotate features on a vector map).
我的公司正在尝试从.NET应用程序迁移到纯粹基于 Web且非常“ajaxy”的应用程序。最初的 .NET 应用程序具有相当的交互性,就用户交互而言(缩放、平移、在矢量地图上注释特征)大致相当于 Google 地图。
Our .NET developer is really taken with Flex2. I'll admit to having a pretty strong Java bias. I also have about a year's worth of experience with GWT, and can get things done pretty quickly with it. Our codebase is mostly J2EE, so GWT seems a natural fit to me. I have zero experience with Flex, so I really can't make a recommendation for or against it
我们的 .NET 开发人员真的很喜欢Flex2。我承认有一个非常强烈的 Java 偏见。我也有大约一年的GWT经验,可以用它很快完成工作。我们的代码库主要是J2EE,所以 GWT 似乎很适合我。我对 Flex 的体验为零,所以我真的无法推荐或反对它
Our primary interests in selecting a framework are the following:
我们选择框架的主要兴趣如下:
- futureproof
- works on all major browsers
- fast & responsive user experience
- code should be unit testable
- code must be maintainable
- speed & ease of development
- supports vector graphics of some sort (SVG a plus)
- 面向未来
- 适用于所有主要浏览器
- 快速响应的用户体验
- 代码应该是可单元测试的
- 代码必须是可维护的
- 开发速度和易用性
- 支持某种矢量图形(SVG 加分)
Care to weigh in on the pros & cons of these two technologies, or even recommend a third option?
仔细权衡这两种技术的优缺点,甚至推荐第三种选择?
回答by rustyshelf
I'm only mildly familiar with Flex, but have worked with GWT for many years. We had to make a very similar decision some years ago (Flash vs GWT), but for different reasons. In the end we saw the many advantages of GWT over Flash (Many of which apply to Flex):
我只是稍微熟悉 Flex,但与 GWT 合作多年。几年前我们不得不做出非常相似的决定(Flash vs GWT),但出于不同的原因。最后我们看到了 GWT 相对于 Flash 的诸多优势(其中很多都适用于 Flex):
Not all our customers have flash, penetration numbers from Adobe are useless, you need your own (which we have) to see what your customers actually have. In corporate and education markets the penetration is actually far lower than the high 90s that Adobe quotes.
GWT is truly cross-browser and platform compatible (Linux, Mac, Windows, Android, iPhone, etc, etc) whereas flash will never be. You may not care about that, but we did.
Flex is proprietry Adobe Technology, whereas GWT is fully open source and customisable
GWT integrates with the DOM, and everything else on your page far easier than flash and Flex do.
GWT is coded in Java, and we all know Java extremely well
并非我们所有的客户都有闪存,来自 Adobe 的渗透率数字没有用,您需要自己的(我们拥有)来查看您的客户实际拥有的内容。在企业和教育市场,渗透率实际上远低于 Adobe 引用的 90 年代高位。
GWT 是真正的跨浏览器和平台兼容(Linux、Mac、Windows、Android、iPhone 等),而闪存永远不会。你可能不在乎,但我们做到了。
Flex 是 Adobe 专有技术,而 GWT 是完全开源和可定制的
GWT 与 DOM 集成,页面上的所有其他内容都比 Flash 和 Flex 容易得多。
GWT 是用 Java 编码的,我们都非常了解 Java
To Address your specific points:
要解决您的具体问题:
* futureproof
Nothing is truly future proof, but I feel that both GWT and Flex would be fairly future proof. Maybe GWT a tiny bit more so because it's open source.
没有什么是真正面向未来的,但我觉得 GWT 和 Flex 都可以面向未来。也许 GWT 稍微多一点,因为它是开源的。
* works on all major browsers
GWT works in Firefox(and all gecko browser), Safari (and all Webkit browsers), IE and Opera. Flex works in all browsers, but only if Flash is supported, so I would say GWT comes out on top there.
GWT 适用于 Firefox(和所有 Gecko 浏览器)、Safari(和所有 Webkit 浏览器)、IE 和 Opera。Flex 适用于所有浏览器,但前提是支持 Flash,所以我会说 GWT 在那里名列前茅。
* fast & responsive user experience
On platforms where it's supported, Flex is going to kill GWT dead for user experience. You just can't compete with flash when it comes to smoothness and slickness.
在支持它的平台上,Flex 将为了用户体验而扼杀 GWT。在平滑度和光滑度方面,您无法与闪光灯竞争。
* code should be unit testable
Both are easily unit testable
两者都很容易进行单元测试
* code must be maintainable
When coded well both are maintainable
当编码良好时,两者都是可维护的
* speed & ease of development
As long as your familiar with them, I'd say it's much of a muchness.
只要你熟悉它们,我会说这是非常多的。
* supports vector graphics of some sort (SVG a plus)
I can't speak for Flex, but GWT supports vector graphics via SVG, through third-party libraries.
我不能说 Flex,但 GWT 通过第三方库通过 SVG 支持矢量图形。
回答by Troy Gilbert
I'm not familiar with GWT, but I'm very familiar with Flex. Even though GWT is Java-based (and it sounds like you're largely a Java shop), I'd recommend Flex based on your listed interests:
我不熟悉 GWT,但我非常熟悉 Flex。尽管 GWT 是基于 Java 的(听起来您主要是一家 Java 商店),但我还是会根据您列出的兴趣推荐 Flex:
Futureproof - Flash powers YouTube and a huge percentage of multimedia on the web... they've built it into video game consoles and Intel is building it into settop boxes. It's going to be here for a long, long time, and Adobe has always maintained 100% backwards compatibility with their Flash players.
Works on all major browsers - yes. And with Flash Player 10, that includes Linux systems as well. And with very minimal admin headaches (way less than Java, in my opinion).
Fast & responsive user experience - yes, though Java can be faster in some scenarios. Flash is optimized for vector rendering, so since that's your target, it may be give you better performance than Java.
Code should be unit testable - yes, see FlexUnit.
Code must be maintainable - definitely. AS3 is a serious language, not a toy scripting language. It will be very familiar to users of C# or Java.
Speed & ease of development - for what you're doing, you'll be able to find dozens of examples of exactly what you described: zooming and panning Google Maps -like vector images. The core of the runtime is a well-designed graphics engine, so building an interactive graphics app is its natural chore.
Supports vector graphics of some sort (SVG a plus) - obviously, Flash does this natively. SVG is supported at the compilation stage (you can compile in SVG but you can't parse SVG at run-time). There are toolchains available that'll convert SVG to SWF for you at runtime.
面向未来 - Flash 为 YouTube 和网络上的大量多媒体提供支持……他们已将其内置于视频游戏机中,而英特尔正在将其内置于机顶盒中。它会存在很长很长时间,而且 Adobe 一直保持 100% 与他们的 Flash 播放器的向后兼容性。
适用于所有主要浏览器 - 是的。Flash Player 10 也包括 Linux 系统。并且管理方面的麻烦非常小(在我看来,比 Java 少得多)。
快速响应的用户体验 - 是的,尽管 Java 在某些情况下可以更快。Flash 针对矢量渲染进行了优化,因此因为这是您的目标,所以它可能会为您提供比 Java 更好的性能。
代码应该是可单元测试的——是的,请参阅 FlexUnit。
代码必须是可维护的——当然。AS3 是一种严肃的语言,而不是一种玩具脚本语言。C# 或 Java 用户会非常熟悉它。
开发速度和易用性 - 对于您正在做的事情,您将能够找到许多与您所描述的完全相同的示例:缩放和平移 Google 地图之类的矢量图像。运行时的核心是精心设计的图形引擎,因此构建交互式图形应用程序是其自然而然的苦差事。
支持某种矢量图形(SVG 加分)- 显然,Flash 本身就是这样做的。编译阶段支持 SVG(您可以在 SVG 中编译,但不能在运行时解析 SVG)。有可用的工具链可以在运行时为您将 SVG 转换为 SWF。
The onlyreason I'd see for using GWT would be to keep your shop Java on server and client... but then again, you're looking for the best tech for the job, right? In that case, I'd say Flash (and in particular, the Flex framework) is best suited for what you're wanting to accomplish.
我认为使用 GWT的唯一原因是将您的商店 Java 保留在服务器和客户端上……但话说回来,您正在寻找最适合这项工作的技术,对吗?在这种情况下,我会说 Flash(尤其是 Flex 框架)最适合您想要完成的任务。
回答by Troy Gilbert
One other point to note is that neither the iPhone nor Android currently support Flash. A lot more people are expecting to access web apps on their phones.
需要注意的另一点是 iPhone 和 Android 目前都不支持 Flash。越来越多的人希望在他们的手机上访问网络应用程序。
回答by putolaruan
I was part of a project that used GWT, and I loved it, especially since Java is my primary programming language of choice. I haven't used Flex, so I'm only giving you info on what I've experienced with GWT. To comment on some your requirements
我参与了一个使用 GWT 的项目,我很喜欢它,尤其是因为 Java 是我选择的主要编程语言。我没有使用过 Flex,所以我只向您提供有关我使用 GWT 的经验的信息。评论您的一些要求
*futureproof - GWT's been there for a couple of years already, and its continually supported by Google.
*works on all major browsers - if you've used GWT, cross-browser programming has never been much easier. GWT does this for you!
*code should be unit testable - yes you can unit test GWT, its also easy to debug GWT.
*speed & ease of development - Ajax is made a lot less complicated thanks to GWT. That alone could speed up your RIA development.
*面向未来 - GWT 已经存在几年了,并且它一直得到 Google 的支持。
*适用于所有主要浏览器 - 如果您使用过 GWT,跨浏览器编程从未如此简单。GWT 为您做到这一点!
*代码应该是可单元测试的——是的,你可以对 GWT 进行单元测试,它也很容易调试 GWT。
*开发速度和易用性 - 由于 GWT,Ajax 的复杂性大大降低。仅此一项就可以加速您的 RIA 开发。
Aside from these, I just have to say, I love their Google Group! It's very active and you could find a lot of people out there that could help you out in case you get stuck with something.
除了这些,我只想说,我喜欢他们的 Google Group!它非常活跃,您可以在那里找到很多人,他们可以在您遇到某些事情时为您提供帮助。
回答by Janci
I've used both te?hnologies for some time.
我已经使用这两种技术有一段时间了。
Futureproof - both of them will be succesful i guess, but every technology will be prefered in different situations. For example flex in large (mostly intranet) enterprises with desired desktop like ui (Flex can be used on the top of the any server platform(jvm,.Net,php,ruby,coldfusion)). GWT otherwise will be dominant in small to medium app with traditional jvm backend (tomcat+spring etc.)
面向未来 - 我猜他们都会成功,但每种技术在不同情况下都会受到青睐。例如在大型(主要是内网)企业中使用像 ui 这样的所需桌面的 flex(Flex 可以在任何服务器平台(jvm、.Net、php、ruby、coldfusion)的顶部使用)。否则 GWT 将在具有传统 jvm 后端(tomcat+spring 等)的中小型应用程序中占据主导地位
Works on all major browsers - both are non-problematic in this way. Flex absolutly excellent, when flash plugin is installed there is not need to solve any cross-browser compatibility (of course... browser are passive, when flash app runs:). I remember we had some minor problems with GWT and tradional troublemaker IE6, but nothing horrible...
适用于所有主要浏览器 - 这两种方式都没有问题。Flex 绝对优秀,安装flash 插件时不需要解决任何跨浏览器兼容性问题(当然……浏览器是被动的,flash app 运行时:)。我记得我们在 GWT 和传统的麻烦制造者 IE6 上遇到了一些小问题,但没什么可怕的......
Fast & responsive user experience - both are the top in their category. Flex i think absolutly the top of the all RIA solutions(maybe silverlight, java fx can be only competitors in richnest), expecially integrated with LCDS with cool features like data management, real server side data push etc. GWT is the one of the top in ajax framework category. The more richest and complicated ui you need, the more reasons to using flex you have. Intepreted javascript in any case can't be faster&responsive then compiled actionscript/swf.
快速响应的用户体验 - 两者都是同类产品中的佼佼者。Flex我认为绝对是所有RIA解决方案中的佼佼者(也许silverlight,java fx只能是richnest的竞争对手),特别是与LCDS集成,具有数据管理,真实服务器端数据推送等很酷的功能。GWT是其中之一在ajax框架类别中。您需要的用户界面越丰富复杂,您就越有理由使用 flex。在任何情况下,解释过的 javascript 都不能比编译的 actionscript/swf 更快且响应更快。
Code should be unit testable - yes, they are greatly testable.
代码应该是可单元测试的——是的,它们是非常可测试的。
Code must be maintainable - both excellent, maintaining actionscript is comparable to java(gwt), if you use a good IDE for example Flex Builder.
代码必须是可维护的——如果你使用一个好的 IDE,例如 Flex Builder,那么优秀的、维护 actionscript 可以与 java(gwt) 相媲美。
Speed & ease of development - both perfect if you know your staff. Everything depends of your backround. For typical java developer learning curve to flex will be probably a little bit more difficult(You need to learn a new compliler/runtime and probably new IDE or at least new eclipse IDE plugin:). Some knowledge of flash is a +, but not required and only usually with specific tasks like building your own components etc.
开发速度和易用性 - 如果您了解您的员工,两者都是完美的。一切都取决于你的背景。对于典型的 Java 开发人员学习曲线来说,flex 可能会更困难一些(你需要学习一个新的编译器/运行时,可能还有新的 IDE 或至少新的 Eclipse IDE 插件:)。一些闪存知识是一个+,但不是必需的,通常只用于构建您自己的组件等特定任务。
Supports vector graphics of some sort (SVG a plus) - no issues I remember, i have no too much experience with this, but i will look at it in future when FXG will be finnalized.
支持某种矢量图形(SVG 加分) - 我记得没有问题,我对此没有太多经验,但我会在未来 FXG 最终确定时查看它。
development & deployment costs - The winner is clear here. GWT. Flex was developed to make a profit. Although self is opensourced, best tools(Flex Builder, new Flash Builder/Catalyst) & frameworks(LCDS) are commerciall and not cheap at all. Look at LCDS per CPU pricelist and you will know what i'm talking about. With GWT most of the quality tools/frameworks are opensourced or free at least. Except some advanced components like ext gwt and smartgwt EE. Obviously u can live without them.
开发和部署成本 - 赢家很明显。GWT。Flex 的开发是为了盈利。尽管 self 是开源的,但最好的工具(Flex Builder、新的 Flash Builder/Catalyst)和框架(LCDS)是商业化的,而且一点也不便宜。查看每个 CPU 价格表的 LCDS,您就会知道我在说什么。使用 GWT,大多数质量工具/框架都是开源的或至少是免费的。除了一些高级组件,如 ext gwt 和 smartgwt EE。显然,没有它们你也能活下去。
回答by DavGarcia
I'm biased toward Flex since I've been doing Flash/Flex development since 2000. I think to answer your question though, it really comes down to the level of interactivity and complexity you want to achieve.
自 2000 年以来我一直在进行 Flash/Flex 开发,因此我偏向于 Flex。我认为要回答您的问题,它实际上归结为您想要实现的交互性和复杂性的级别。
Flex is going to let you do things that would be nearly impossible in a JavaScript environment (ASP.NET AJAX, jQuery, GWT) such as simple 3d graphics. Building complex interactivity is really trivial in Flex. Also it is very fast and can handle lots of animated objects at a time. Flex can communicate seamlessly to .NET or Java using web services. The downside of using Flex is that it feels like an embedded application on your web site rather than something that is tightly integrated.
Flex 将让您完成在 JavaScript 环境(ASP.NET AJAX、jQuery、GWT)中几乎不可能完成的事情,例如简单的 3d 图形。在 Flex 中构建复杂的交互性非常简单。它也非常快,可以一次处理大量动画对象。Flex 可以使用 Web 服务与 .NET 或 Java 无缝通信。使用 Flex 的缺点是感觉就像是网站上的嵌入式应用程序,而不是紧密集成的东西。
If you are going to stick with a JavaScript approach, usually I'd suggest using something language agnostic like jQuery. But since you already have GWT experience, that may work well for your project. The downside is that GWT in the end is still JavaScript, so you are going to be limited by the speed and interactivity of what is possible in a browser.
如果您打算坚持使用 JavaScript 方法,通常我会建议使用诸如 jQuery 之类的与语言无关的东西。但是由于您已经拥有 GWT 经验,这可能对您的项目很有效。缺点是 GWT 最终仍然是 JavaScript,因此您将受到浏览器中可能的速度和交互性的限制。
回答by Hayden Jones
Sun has recently launched a new technology called JavaFX for these kinds of RIAs. You may want to check it out (javafx.com). It is suppose to run on Java 5 or better but that will definitely not have the kind of client penetration that Flash does. I think however given your requirements for testing that this technology may not be appropriate at this time.
Sun 最近针对此类 RIA 推出了一项名为 JavaFX 的新技术。您可能想查看一下 (javafx.com)。它假设运行在 Java 5 或更高版本上,但绝对不会像 Flash 那样具有客户端渗透性。但是,我认为鉴于您对测试的要求,目前该技术可能不合适。
Also, I think Troy Gilbert made an error in his post. Specifically, he seems to indicate that a GWT application will run (by the client) in java. I'm almost certain that a GWT application is written first in Java and then GWT will compile that into a javascript library that the client runs.
另外,我认为特洛伊吉尔伯特在他的帖子中犯了一个错误。具体来说,他似乎表明 GWT 应用程序将在 Java 中运行(由客户端)。我几乎可以肯定 GWT 应用程序首先是用 Java 编写的,然后 GWT 会将其编译成客户端运行的 javascript 库。
回答by Joe NaPuu
This really is an apples / oranges question. With GWT, you get the pureness of writing everything in Java. Ironically, the end result will never feel like anything other than a website.
这真的是一个苹果/橙子的问题。使用 GWT,您可以获得用 Java 编写所有内容的纯粹性。具有讽刺意味的是,最终结果永远不会像网站之外的任何东西。
With Flex, you get to write something that feels like an application. And, perhaps most importantly, with Flex, there is NOTHING you cannot do programatically - whether functional or graphical.
使用 Flex,您可以编写一些感觉像应用程序的东西。而且,也许最重要的是,有了 Flex,您就可以通过编程来完成任何事情——无论是功能性的还是图形化的。
If you are developing applications for a specific user base, Flex is a winner by miles. If you are building a mass social web based whatever, GWT is definitely a better choice.
如果您正在为特定用户群开发应用程序,那么 Flex 无疑是赢家。如果您正在构建基于任何内容的大众社交网络,GWT 绝对是更好的选择。
回答by New Poster
Future proofing is more about architecture than it is about a specific technology. With the right architecture you can pretty easily swap out presentation technology. I like Silverlight/MVVM although the pattern does require some planning to also support HTML5.
面向未来更多地是关于架构而不是关于特定技术。使用正确的架构,您可以非常轻松地更换演示技术。我喜欢 Silverlight/MVVM,尽管该模式确实需要一些计划才能支持 HTML5。
回答by New Poster
While iPhone and Android do not support flash YET, you should also note that Google create applications targeted for the mobile phone. They are doing that because the screen on mobile devices is vastly smaller then the typical laptop/desktop. Therefore, the lack of flash support is a non-issue, since a targeted app provides a better user experience.
虽然 iPhone 和 Android 不支持 Flash YET,但您还应该注意到 Google 创建了针对手机的应用程序。他们这样做是因为移动设备上的屏幕比典型的笔记本电脑/台式机小得多。因此,缺少 Flash 支持不是问题,因为目标应用程序可提供更好的用户体验。

