jQuery GWT 仍然适用于新项目吗?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20095858/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-27 00:58:15  来源:igfitidea点击:

Is still GWT pertinent for new projects?

jquerygwtextjsgxtgquery

提问by olibre

The question Why should I use jQuery instead of GWT?may be outdated (as its answers). And mostoftheother SO related questions may also be outdated nowadays. So, let's update the state of the artabout GWT relevance for new projects.

问题为什么我应该使用 jQuery 而不是 GWT?可能已过时(作为其答案)。和大多数其他SO相关的问题也可如今已经过时。所以,让我们更新最先进的约GWT相关的新项目。

GWT is more mature nowadays

GWT现在更成熟了

Since 2009 questions/answers, GWT has evolved and some JS frameworks are available in Java:

自 2009 年问答以来,GWT 不断发展,一些 JS 框架在 Java 中可用:

  • GwtQueryfor jQuery (gQuery)
  • GXTfor ExtJS (former ExtGWT)
  • Smart GWThas superseded GWT-ext
  • ... and surely more ... (please feel free to append)

And even more, Java code can be converted to standalone JS libraries: gwt-exporter

更重要的是,Java 代码可以转换为独立的 JS 库:gwt-exporter

But low-level JS frameworks may be enough

但是低级 JS 框架可能就足够了

But more I read, more I see web developers advising to turn his back on GWT and use directly JS frameworks (Firebug, IDE plugins for JS frameworks...).

但是我读得越多,我看到 Web 开发人员建议放弃 GWT 并直接使用 JS 框架(Firebug,JS 框架的 IDE 插件......)。

Productivity

生产率

However I like the idea of developing and debugging using the same IDE (Eclipse, Netbeans, IntelliJ IDEA...). I thinkI will be more productive... I should also think about Documentation and Community (forum reactivity as for this SO question)...

但是,我喜欢使用相同的 IDE(Eclipse、Netbeans、IntelliJ IDEA...)进行开发和调试的想法。我我会更有效率......我还应该考虑文档和社区(论坛反应性对于这个问题)......

Questions

问题

  1. For what kind of new 2014 project GWT should be (or not) considered?
  2. Are there pertinentalternatives to GWT for easy AJAX web application development & deployment?
  3. What are the current mode and trend?
  1. 应该(或不)考虑 GWT 什么样的新 2014 项目?
  2. 是否有相关的GWT 替代品可以轻松进行 AJAX Web 应用程序开发和部署?
  3. 目前的模式和趋势是什么?

My specific case

我的具体情况

I have just completed a POC (of an intranet web app) based on Python3 (http.server.HTTPServer) calling (POST) bashscripts (some processing in C++) and retrieving JSON data. Some JS (no framework) in the web page for rendering. So I am wondering the best option for next iteration.

我刚刚完成了一个基于 Python3 ( http.server.HTTPServer) 调用 (POST)bash脚本(一些 C++ 处理)并检索 JSON 数据的 POC(一个 Intranet Web 应用程序)。网页中的一些JS(无框架)进行渲染。所以我想知道下一次迭代的最佳选择。

But please answer this question about other cases too. I would prefer a general question/answer to be useful to many more people.

但也请回答有关其他情况的这个问题。我希望一个对更多人有用的一般问题/答案。



UPDATE October 2015

2015 年 10 月更新

GWT looks less active because no new release since 11 month. But in the past until 13 months between versions 2.4 and 2.5. The Git repo mirroris still very active. Moreover GWT is extensible, and new features can come from GWT libraries without requiring new GWT framework release. See for example the most common mobile GWT librariesand there corresponding release cycles. In the mean time the trend is to use Node.js everywhere! Adoption of GWT for new projects really depends on developers skills/motivation and project lifetime (turnover/training/maintenance). Some other criteria as reuse of available source code and time-to-market may also be taken into account... See excellent below answers.

GWT 看起来不太活跃,因为自 11 个月以来没有新版本。但过去直到2.4 和 2.5 版本之间13 个月。在Git的回购镜仍然非常活跃。此外,GWT 是可扩展的,新特性可以来自 GWT 库,而无需发布新的 GWT 框架。例如,查看最常见的移动 GWT 库和相应的发布周期。与此同时,趋势是到处使用 Node.js!新项目采用 GWT 确实取决于开发人员的技能/动机和项目生命周期(周转/培训/维护)。还可以考虑其他一些标准,例如重用可用源代码和上市时间......请参阅下面的优秀答案。

采纳答案by Steffen Sch?fer

For point 1 I can give you some criteria that I would use:

对于第 1 点,我可以给你一些我会使用的标准:

When using JavaScript based frameworks you are typically very fast in the initial creation of the code. In my experience, you are much slower when it comes to maintenance (bug fixes, new features, refactorings) as tool support isn't that good as it is for statically typed languages. So for bigger or long running projects I would always choose GWT because of Java and it's compiler checks/ecosystem/tooling. I think you will benefit of better efficiency and scaling in development over time as you won't have strange problems due to dynamic typing. For smaller projects that won't live too long or won't need big refactorings, JavaScript Frameworks can be a big push in development speed.

使用基于 JavaScript 的框架时,您通常在最初创建代码时速度非常快。根据我的经验,在维护(错误修复、新功能、重构)方面,您的速度要慢得多,因为工具支持不如静态类型语言那么好。因此,对于更大或长期运行的项目,我总是会选择 GWT,因为 Java 和它的编译器检查/生态系统/工具。我认为随着时间的推移,您将受益于更高的效率和开发规模,因为您不会因动态类型而遇到奇怪的问题。对于寿命不会太长或不需要大规模重构的小型项目,JavaScript 框架可以极大地提高开发速度。

Debugging needs in the context of your target platform are also a criteria for me. Debugging GWT Code is very nice as long as you have a browser that is supported by DevMode or at least can be used with the new source maps based SuperDevMode. E.g. Safari on MacOS X isn't supported. For mobile devices, you can remote debug JavaScript on Android Chrome but as far as I know this isn't possible for GWT.

目标平台上下文中的调试需求对我来说也是一个标准。只要您的浏览器受 DevMode 支持,或者至少可以与基于 SuperDevMode 的新源映射一起使用,调试 GWT 代码就非常好。例如,不支持 MacOS X 上的 Safari。对于移动设备,您可以在 Android Chrome 上远程调试 JavaScript,但据我所知,这对于 GWT 是不可能的。

Another criteria for me is team size and turnover rate. Java based tools (IDE's, code quality checkers, ...) help developers, especially new ones to navigate through other developers' code. This is also true for other statically types languages, but you asked for GWT/Java.

对我来说另一个标准是团队规模和失误率。基于 Java 的工具(IDE、代码质量检查器等)可帮助开发人员,尤其是新开发人员浏览其他开发人员的代码。对于其他静态类型语言也是如此,但您要求使用 GWT/Java。

The next one is the stack question ... GWT easily solves the client and remote communication part if use a servlet container on the server side. It's also easy to combine it with mature Java enterprise technologies (JPA, EJB, Spring framework, ...). This is a big strength if you need/want to have the stack. If you are going polyglot without JVM on your server side(as mentioned above), this one isn't for you.

下一个是堆栈问题……如果在服务器端使用 servlet 容器,GWT 可以轻松解决客户端和远程通信部分。将它与成熟的 Java 企业技术(JPA、EJB、Spring 框架等)结合起来也很容易。如果您需要/想要拥有堆栈,这是一个很大的优势。如果您要在服务器端没有 JVM 的情况下使用多语言(如上所述),那么这个不适合您。

Sure, there are more criteria for both, GWT and JavaScript frameworks.

当然,GWT 和 JavaScript 框架都有更多标准。

And the big question is about preferences. JavaScript has really nice concepts (e.g. Closures) but is also a risk due to it's dynamic typing. Which one do you prefer?

最大的问题是关于偏好。JavaScript 有非常好的概念(例如闭包),但由于它是动态类型,因此也存在风险。你更倾向哪个?

Regarding point 2:

关于第 2 点:

I'm not sure if there is a real alternative for GWT that provides similar features and tooling. Most other frameworks focus on one aspect only (Widgets, optimization, databinding, remote communication, browser support, I18n, ...). That doesn't mean, other frameworks are bad, but you typically need a combination of different frameworks to get the functionality that GWT provides.

我不确定 GWT 是否有提供类似功能和工具的真正替代品。大多数其他框架只关注一个方面(小部件、优化、数据绑定、远程通信、浏览器支持、I18n 等)。这并不意味着其他框架不好,但您通常需要组合不同的框架来获得 GWT 提供的功能。

Regarding point 3:

关于第 3 点:

  • I would definitely have a look at TypeScript due to it's improved typing and interoperability with JavaScript
  • As far as I remember, Dart has a similar goal
  • The evergreen is JQuery but dependent on your needs there are good alternatives. But that is highly subjective
  • For widgets, Twitter Bootstrap (http://getbootstrap.com/) is nice if it's way to do things is ok for you. There's even a GWT version of it (http://gwtbootstrap.github.io/)
  • 我肯定会看看 TypeScript,因为它改进了打字和与 JavaScript 的互操作性
  • 据我所知,Dart 也有类似的目标
  • 常青树是 JQuery,但根据您的需要,有很好的选择。但这是非常主观的
  • 对于小部件,Twitter Bootstrap ( http://getbootstrap.com/) 很好,如果它的处理方式适合您。甚至还有一个 GWT 版本(http://gwtbootstrap.github.io/

回答by ATrubka

Great answer by Steffen. I started typing it as comment to his, but found that I typed more than I expected, so making it a separate answer. Not hunting for points...

斯蒂芬的精彩回答。我开始输入它作为对他的评论,但发现我输入的比我预期的要多,因此将其作为单独的答案。不求积分...

I just wanted to add 1 subjective point of mine. The reality is that majority of developers are so-called backend developers with no knowledge, experience and most importantly desire to develop web frontend. Reality of US IT market is that majority would prefer Java in their resume over JS, PHP, Python and other exotic languages. The reason is compensation. Java developers on average get paid more. Not sure about other countries.

我只是想补充一点我的主观观点。现实情况是,大多数开发人员都是所谓的后端开发人员,没有知识、经验,最重要的是没有开发 Web 前端的愿望。美国 IT 市场的现实是,大多数人在简历中更喜欢 Java,而不是 JS、PHP、Python 和其他外来语言。原因是赔偿。Java 开发人员的平均报酬更高。其他国家不清楚。

So majority of developers in a company would be Java developers (or .NET, which is outside of this conversation). In order to make them work on UI you have to use a Java compatible technology, which would be JSP or GWT. JSP would require to learn JS libraries to make the frontend more or less presentable.

因此,公司中的大多数开发人员将是 Java 开发人员(或 .NET,不在此讨论范围内)。为了使它们在 UI 上工作,您必须使用 Java 兼容技术,即 JSP 或 GWT。JSP 需要学习 JS 库才能使前端或多或少具有可展示性。

Obviously, if you want to impress public with unique UI you have to use JS libraries that allow for greater customization. Both JSP and GWT would work as majority of work is going to be done in JS. As I mentioned above, few companies would have experienced JS developers on staff.

显然,如果你想用独特的 UI 给公众留下深刻印象,你必须使用允许更多自定义的 JS 库。JSP 和 GWT 都可以工作,因为大部分工作都将在 JS 中完成。正如我上面提到的,很少有公司会拥有经验丰富的 JS 开发人员。

Majority of applications though are written for internal use, not facing public. From what you described, your use case may fall under this category.

尽管大多数应用程序是为内部使用而编写的,而不是面向公众。根据您的描述,您的用例可能属于此类别。

Internal non publicly facing tools often have a more complex functionality than public websites, but their design requirements are more relaxed as long as functionality is there and convenient for internal use.

内部非公开工具通常具有比公共网站更复杂的功能,但只要功能存在且便于内部使用,它们的设计要求就更加宽松。

In this case you can get away with GWT, which is less foreign for Java developers than jQuery and a high level library such as GXT with standard theme.

在这种情况下,您可以使用 GWT,它对 Java 开发人员来说比 jQuery 和具有标准主题的高级库(例如 GXT)更不陌生。

GWT with GXT for us was an easy and quick way to create a set of internal applications. With the team of Java developers our company has, we would never come close to the quality or even completeness of projects within the same period of time.

GWT 和 GXT 对我们来说是一种创建一组内部应用程序的简单快捷的方法。凭借我们公司的Java开发团队,我们将永远无法在同一时期内接近项目的质量甚至完整性。

回答by Toskan

Just head off to: GWTs example page, showcasing real world examples of GWT applications

只需前往:GWT 示例页面,展示 GWT 应用程序的真实示例

Just read about the super heavy weight nature of these examples.

只需阅读这些示例的超重性质。

GWT itself is not that light weight, and I doubt it was designed to create a datepicker. GWT is something completely else than jQuery as well. It is maybe more comparable to JSF2 than to jQuery. The question "should I use GWT or jQuery" could be answered like:

GWT 本身并不是那么轻量级,我怀疑它是为了创建日期选择器而设计的。GWT 也完全不同于 jQuery。它可能更类似于 JSF2 而不是 jQuery。“我应该使用 GWT 还是 jQuery”这个问题可以这样回答:

if you want to add datepickers, some effects, a sortable table, an autocomplete here and there. You should probably go with jQuery.

如果你想在这里和那里添加日期选择器、一些效果、一个可排序的表格、一个自动完成。您可能应该使用 jQuery。

If you want to figure out if you want to use GWT as the frontend template / engine mechanism, you should consider other that are actually comparable. When discussing java, probably JSF2 is your only choice. And JSF learning curve is steep.

如果您想弄清楚是否要使用 GWT 作为前端模板/引擎机制,您应该考虑其他实际上具有可比性的。在讨论 java 时,可能 JSF2 是您唯一的选择。JSF 学习曲线很陡峭。

I am digging deeper and I found a sad post:

我正在深入挖掘,发现了一个悲伤的帖子:

http://polygoncell.blogspot.mx/2013/07/gwt-for-new-project-no-thanks.html

http://polygoncell.blogspot.mx/2013/07/gwt-for-new-project-no-thanks.html

I came to this page because I was reading about the upcoming projects like AngularJS, Backbone, single page applications (SPA): In short, google dropped GWT. GWT is now open source, because they just abandoned it. Now AngularJS gets a big push by google.

我来到这个页面是因为我正在阅读即将推出的项目,如 AngularJS、Backbone、单页应用程序 (SPA):简而言之,谷歌放弃了 GWT。GWT 现在是开源的,因为他们刚刚放弃了它。现在 AngularJS 得到了谷歌的大力推动。

EDITour dear andrew told me to "prove my point"

编辑我们亲爱的安德鲁告诉我“证明我的观点”

here is the algorithm to use to evaluate if a technic is competitive.

这是用于评估技术是否具有竞争力的算法。

1) Go to your favorite job site

2) Search for {technology which interests you} jobs

3) Check out number of openings, related technology requirement etc

4) Repeat #2 & #3 for competitive technologies

5) Evaluate

1)去你最喜欢的工作网站

2) 搜索{您感兴趣的技术}工作

3) 查看开孔数量、相关技术要求等

4)对有竞争力的技术重复#2和#3

5) 评估

today 19. may 2016, on upwork i searched for GWTjobs.

今天 2016 年 5 月 19 日,我在 upwork 上找GWT工作。

Jobs: 23.

工作:23。

I searched for angularjsjobs.

我寻找angularjs工作。

Jobs: 1338. That's right. one thousand three hundred thirty eight.

乔布斯:1338。没错。一千三百三十八。

point proven?

点证明?

回答by Nick

I guess to answer point 1, you'd have to look at what your current situation is and what your goals are.

我想要回答第 1 点,您必须查看您当前的情况以及您的目标。

If you have a team of developers that have been using Java most of their careers, you can probably expect a good 6 months for them to learn the paradigms of JavaScript. If the have experience in languages like Groovy or Clojure, you could probably cut that time down some. So, if you aren't expecting the project to last more than a year or so, then GWT would probably be the way to go.

如果您有一个开发人员团队,他们的大部分职业生涯都在使用 Java,那么您可能需要 6 个月的时间来学习 JavaScript 的范式。如果您有使用 Groovy 或 Clojure 等语言的经验,您可能会缩短一些时间。因此,如果您不希望该项目持续超过一年左右的时间,那么 GWT 可能是您要走的路。

Conversely, if you have a team of JS developers, they may find the static typing system rather frustrating and learning to use it effectively could take half a year for them. So if this is the case, then you probably wouldn't want to use GWT for any new project where the learning curve outweighs the productivity.

相反,如果你有一个 JS 开发团队,他们可能会发现静态类型系统相当令人沮丧,并且学习有效地使用它可能需要半年时间。因此,如果是这种情况,那么您可能不想将 GWT 用于任何学习曲线超过生产力的新项目。

I'm not really sure what point 2 is asking. If you are asking about whole stack frameworks, I'm guessing you could find something using nodejs, though I don't think I have enough experience to advise on that.

我不太确定第 2 点在问什么。如果您询问整个堆栈框架,我猜您可以使用 nodejs 找到一些东西,尽管我认为我没有足够的经验来就此提出建议。

On point 3, where I work, we seem to be moving towards using JS frameworks (AngularJS in particular) with some (new) servers/services written in Python and Groovy, and the legacy systems still in Java. We also have a couple of services being written in Clojure.

在我工作的第 3 点,我们似乎正在转向使用 JS 框架(特别是 AngularJS)和一些用 Python 和 Groovy 编写的(新)服务器/服务,而遗留系统仍然用 Java。我们还有一些服务是用 Clojure 编写的。

回答by jgleoj23

GWT is pertinent. It has 130,000 developers using it. If you don't believe me just look at [GWT is coming back in .. in 2015][blog.xam.de/2014/02/gwt-is-coming-back-in-2015.html] and another stackexchange question which talks about this. GWT shouldn't be you're first option because it adds a lot of complexity.

GWT 是相关的。它有 130,000 名开发人员在使用它。如果您不相信我,只需看看 [GWT 将在 2015 年回归..][blog.xam.de/2014/02/gwt-is-coming-back-in-2015.html] 和另一个堆栈交换问题其中谈到了这一点。GWT 不应该是您的首选,因为它增加了很多复杂性。

What projects are GWT good for? GWT is much more complicated:

GWT 适合哪些项目?GWT要复杂得多

  • Java is a harder language that makes it hard to write bad code
  • Compiling to javaScript adds complexity
  • GWT was built from the ground up for extremely complicated web apps
  • the GWT community tends to prioritize user experience and performance over developer experience more than the javaScript community
  • Java 是一种更难的语言,很难写出糟糕的代码
  • 编译为 javaScript 会增加复杂性
  • GWT 是为极其复杂的 Web 应用程序从头开始构建的
  • 与 javaScript 社区相比,GWT 社区倾向于将用户体验和性能置于开发人员体验之上

However, the it's cleaner more maintainable code, it's java, it's faster, and you can reuse your code on the jvm and ios if you use J2ObjC

但是,它更干净更易于维护的代码,它是 java,它更快,如果您使用 J2ObjC,您可以在 jvm 和 ios 上重用您的代码

there are some very compelling reasons to use GWT - Java
- reuse your own code from other platforms. For example, google inbox reuses most of it's android code on the web using GWT and reuses it's code again on iPhone(thank J2ObjC) and the server(thank the JVM's ability to run on many different platforms). - use java libraries and tools, java developers - many developers prefer java to js and have good reasons to prefer it - built from the ground up for complicated, performant web apps. - Java code is cleaner and more maintainable

使用 GWT - Java
- 从其他平台重用您自己的代码有一些非常令人信服的理由。例如,谷歌收件箱使用 GWT 在网络上重用大部分 android 代码,并在 iPhone(感谢 J2ObjC)和服务器上再次重用它的代码(感谢 JVM 能够在许多不同平台上运行)。- 使用 Java 库和工具,Java 开发人员 - 许多开发人员更喜欢 Java 而不是 js,并且有充分的理由喜欢它 - 从头开始​​为复杂、高性能的 Web 应用程序构建。- Java 代码更简洁,更易于维护

GWT has been going down according to google trendsand indeed job trendsbut javaScript and jQuery are also going down. I don't know why these technologies are all going down. My theory is that there's a lot of new frameworks that are stealing developers from GWT and javaScript. I don't think this necessarily means that javaScript and GWT are dying yet though. This nothing more than the result of having a lot more competition.

根据谷歌趋势就业趋势,GWT 一直在下降,但 javaScript 和 jQuery 也在下降。我不知道为什么这些技术都在下降。我的理论是,有很多新框架正在从 GWT 和 javaScript 中窃取开发人员。我认为这并不一定意味着 javaScript 和 GWT 正在消亡。这只不过是更多竞争的结果。