最大的GWT陷阱? [英] Biggest GWT Pitfalls?

查看:214
本文介绍了最大的GWT陷阱?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在,我们选择实施使用GWT项目的开始/中间。有没有人遇到什么大的缺陷在使用GWT(和GWT-EXT),其无法克服的?如何从性能的角度?

这是我们见过一对夫妇的事情/听说已经包括了:

  • 在谷歌不能够索引内容
  • 在一般的CSS和造型似乎有点片状

寻找这些项目的任何额外的反馈也是如此。谢谢!

解决方案

我会说,我是一个巨大的GWT粉丝,但肯定也有很多陷阱,但就大多数,如果不是全部,我们能够克服:

问题:长编译时间,为你的项目的发展也是如此才能编译它的时间量。我听说过的20分钟编译报道,但我的是平均约1分钟。

解决方法:分裂您的code成单独的模块,并告诉蚂蚁只有建立它时,它的改变。此外,同时开发,你可以大规模加速仅建立一个浏览器的编译时间。你可以把这个放入你的.gwt.xml文件中做到这一点:

 <设置属性名=user.agent值=gecko1_8/>
 

在哪里gecko1_8是Firefox的2 +,IE6是IE浏览器,等等。


问题:托管模式是非常缓慢(在OS X上至少),不接近匹配的'活'的变化,当你编辑之类的东西JSP或Rails的网页你和命中刷新在您的浏览器。

解决方法::您可以给主机模式更多的内存(我一般得到的512M),但它仍然是缓慢的,我发现一旦你不够好使用GWT您停止使用此。您更改的一大块,然后编译只是一个浏览器(通常是20多岁的编译价值),并在浏览器中,然后只需点击刷新。

更新:使用GWT 2.0+这不再是一个问题,因为你使用新的发展模式。这基本上意味着你可以运行code直接在您选择的浏览器,所以没有损失的速度,再加上你可以萤火/检查它,等等。

<一个href="http://$c$c.google.com/p/google-web-toolkit/wiki/UsingOOPHM">http://$c$c.google.com/p/google-web-toolkit/wiki/UsingOOPHM


问题: GWT code是java的,并有不同的心态,奠定了一个HTML页面,这使得采取的HTML设计,使之成为GWT困难

解决方法:同样你习惯这一点,但不幸的是转换的HTML设计一个GWT设计总是会比做这样转换的HTML设计一个JSP页面慢


问题: GWT需要多一点的身边让你的头,并且还不是主流。这意味着大多数开发商加入你的团队或保持你的code将不得不从头学起它

解决方法:这还有待观察,如果GWT将起飞,但如果你是一个公司,你雇用谁的控制权,那么你总是可以选择的人,要么知道GWT或者想学习吧。


问题: GWT是一个大锤相比,像jQuery的或只是简单的JavaScript。它需要更多的设置,以获得它的发生不是仅仅包括一个JS文件。

解决方法:使用库,比如jQuery的为适合于那些规模较小的,简单的任务。当你想建立的东西在AJAX真正复杂的使用GWT,或者需要通过RPC机制通过您的数据来回。


问题:有时为了填充GWT的网页,你需要一台服务器调用的页面首次加载时。它可以是恼人的为用户坐在那里,看着装载的象征,而你把你需要的数据。

解决方法:在JSP页面的情况下,你的页面已经呈现由服务器成为HTML之前,所以你其实可以让你的GWT所有然后调用和pre-负荷他们到页面上,瞬间负载。看到这里的细节:

<一个href="http://wiki.shiftyjelly.com/index.php/GWT#Speed_up_Page_Loading.2C_by_$p$p-serializing_your_GWT_calls">Speed高达页由pre序列化加载你的GWT调用


我从来没有任何问题的CSS样式我的小部件,开箱即用,习惯或其他原因,所以我不知道你所说的,作为一个陷阱呢?

至于性能,我一直认为,一旦编译GWT code是速度快,AJAX调用是不是做一整页刷新几乎总是较小,但是这不是真正独特的GWT,虽然本机的RPC数据包你得到,如果你使用Java后端是pretty的紧凑。

I'm at the beginning/middle of a project that we chose to implement using GWT. Has anyone encountered any major pitfalls in using GWT (and GWT-EXT) that were unable to be overcome? How about from a performance perspective?

A couple things that we've seen/heard already include:

  • Google not being able to index content
  • CSS and styling in general seems to be a bit flaky

Looking for any additional feedback on these items as well. Thanks!

解决方案

I'll start by saying that I'm a massive GWT fan, but yes there are many pitfalls, but most if not all we were able to overcome:

Problem: Long compile times, as your project grows so does the amount of time it takes to compile it. I've heard of reports of 20 minute compiles, but mine are on average about 1 minute.

Solution: Split your code into seperate modules, and tell ant to only build it when it's changed. Also while developing, you can massively speed up compile times by only building for one browser. You can do this by putting this into your .gwt.xml file:

<set-property name="user.agent" value="gecko1_8" />

Where gecko1_8 is Firefox 2+, ie6 is IE, etc.


Problem: Hosted mode is very slow (on OS X at least) and does not come close to matching the 'live' changes you get when you edit things like JSPs or Rails pages and hit refresh in your browser.

Solution: You can give the hosted mode more memory (I generally got for 512M) but it's still slow, I've found once you get good enough with GWT you stop using this. You make a large chunk of changes, then compile for just one browser (generally 20s worth of compile) and then just hit refresh in your browser.

Update: With GWT 2.0+ this is no longer an issue, because you use the new 'Development Mode'. It basically means you can run code directly in your browser of choice, so no loss of speed, plus you can firebug/inspect it, etc.

http://code.google.com/p/google-web-toolkit/wiki/UsingOOPHM


Problem: GWT code is java, and has a different mentality to laying out a HTML page, which makes taking a HTML design and turning it into GWT harder

Solution: Again you get used to this, but unfortunately converting a HTML design to a GWT design is always going to be slower than doing something like converting a HTML design to a JSP page.


Problem: GWT takes a bit of getting your head around, and is not yet mainstream. Meaning that most developers that join your team or maintain your code will have to learn it from scratch

Solution: It remains to be seen if GWT will take off, but if you're a company in control of who you hire, then you can always choose people that either know GWT or want to learn it.


Problem: GWT is a sledgehammer compared to something like jquery or just plain javascript. It takes a lot more setup to get it happening than just including a JS file.

Solution: Use libraries like jquery for smaller, simple tasks that are suited to those. Use GWT when you want to build something truly complex in AJAX, or where you need to pass your data back and forth via the RPC mechanism.


Problem: Sometimes in order to populate your GWT page, you need to make a server call when the page first loads. It can be annoying for the user to sit there and watch a loading symbol while you fetch the data you need.

Solution: In the case of a JSP page, your page was already rendered by the server before becoming HTML, so you can actually make all your GWT calls then, and pre-load them onto the page, for an instant load. See here for details:

Speed up Page Loading by pre-serializing your GWT calls


I've never had any problems CSS styling my widgets, out of the box, custom or otherwise, so I don't know what you mean by that being a pitfall?

As for performance, I've always found that once compiled GWT code is fast, and AJAX calls are nearly always smaller than doing a whole page refresh, but that's not really unique to GWT, though the native RPC packets that you get if you use a JAVA back end are pretty compact.

这篇关于最大的GWT陷阱?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆