gwt + multiple modules in same app

已查看 113 次
跳至第一个未读帖子

Joni

未读,
2006年11月22日 08:48:372006/11/22
收件人 Google Web Toolkit
Hello,

i am trying to build app that uses multiple "modules" under same
application. Is this possible to do or do i have to build new app for
every "module"?

My app has "default" module which uses gwt.js as its gwt-script. Now if
i would like to split my application into parts is it possible under
same application/project?

Lets say, that my app has now all its code in "default" module and it
uses gwt.js as its gwt-script like i told. Now what if i would likt to
build login-app for my application Do i have to build entire new
application or is this possible to build inside of my current
application? Does gwt put all the code in same .js file or does it
split all modules in their own files?

my current "module" is loaded on page like this:

<meta name='gwt:module' content='com.company.gwt.app'>
<script language="javascript" src="gwt.js"></script>

And entrypoint of app is defined in app.gwt.xml like this:

<module>

<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User'/>

<!-- Specify the app entry point class. -->
<entry-point class='com.company.gwt.client.EntryPoint'/>

</module>

Luciano Broussal

未读,
2006年11月22日 10:14:562006/11/22
收件人 Google Web Toolkit
Hi,

A module is different from an EnrtyPoint
you can have severals modules (gwt libs) used by a same entry point (a
gwt application)

So what you want exactly do ?

Joni

未读,
2007年1月15日 02:34:082007/1/15
收件人 Google Web Toolkit
Okay, sorry about the delay...

What i want to do is put multiple entry points in the same app. I can
define multiple entrypoints in my xml file (app.gwt.xml) like this:

<module>

<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User'/>

<!-- Specify the app entry point class. -->
<entry-point class='com.company.gwt.client.EntryPoint'/>

<entry-point class='com.company.gwt.client.Login'/>
<entry-point class='com.company.gwt.client.Shop'/>

</module>

but how do i define which one is loaded on my single html page?
Does gwt put all my entrypoints in the same js (gwt.js) or does every
entry point get its own js?

Thanx!

csar

未读,
2007年2月18日 05:00:552007/2/18
收件人 Google Web Toolkit
It seems that the first EntryPoint defined creates the html-page and
this it _the_ entry point of the app.

I wrote a registry where each entry-point adds itself during
onModuleLoad, later any entry point can lookup the other running in
that root. The registry has to be two-layered, it is a hashmap by
RootPanel.getBodyElement for hashmaps of name, EntryPoint instance.

All my Entrypoints have a single panel in the RootPanel, I simply
switch them between visible/invisible. Works fine

charlie...@gmail.com

未读,
2007年2月18日 07:55:512007/2/18
收件人 Google Web Toolkit
I am confused as to why you guys want to do this? Really, an honest
question, I am trying to understand.

If you have a "Login" widget, and a "Shop" widget, then you can switch
them in and out of the same "page" without them being in different
EntryPoint classes. And, if you make the logic for each a "module",
including whatever client side model each may have, related RPC code,
etc, you can then easily inherit Shop and Login in a new module,
intended to combine those other modules - and all the logic will be
there, and will be nicely encapsulated per module.

Why do you want to use separate entry point classes over
inheritance?

I ask because at this point GWT will create the JS files as one large
block, if they reference each other (if you map them together, as the
"registry" approach seems to describe). So the same code download is
present, you are just working against the grain. I suppose either way
would work, but I am still not understanding what advantage multiple
entry points achieves?

Ian Bambury

未读,
2007年2月18日 11:21:352007/2/18
收件人 Google-We...@googlegroups.com
You have three choices:

a login widget and a default widget (your names minus the double-quotes whose significance I fail to understand)
 
In an app, you start off with the login widget and once logged in, you hide the login widget and show the default widget - one app, 2 widgets
 
Or you put one widget in one app in one html page and change to a completely different page if logged in or not.
Or you have one page and two apps using the same page.
 
It might be better if you took a step back and said what you are trying to do. Or find out what GWT does first. In the end, it's usually quicker than trying to hammer a large round bolt into a small sqaure hole with the wrong end of a screwdriver whilst wearing welding goggles. :-))

charlie...@gmail.com

未读,
2007年2月21日 10:41:412007/2/21
收件人 Google Web Toolkit
I know this is old at this point but I asked Bruce Johnson about
multiple modules and spreading a "big" app across them last night at
the Atlanta JUG - where Bruce did a presentation on GWT.

Basically he said you can do that pretty nicely right now by using the
History support, but that he agreed with me about being skeptical of
what a "big" app is (if you are using HTTP compression and OBF and so
on). Put your modules on different pages and using GWT History
support just forward to another module seamlessly. This way not only
can you separate out modules, host pages, entry points, etc, if you
need to, but you also get a final "app" that users can browse through,
forward and back while crossing app boundaries and not know it.

Ian Bambury

未读,
2007年2月21日 11:20:212007/2/21
收件人 Google-We...@googlegroups.com
That is great news, just use History support?

BTW for me, a big app is 380kb with OBF but without compression
(because it's not my server), without images, for a user on dial-up
(maybe not even on 56kbps) who is paying by the minute.

So how do I split my 380kb into smaller chunks using History support?

Ian

http://roughian.com/camino2003/

Ian Bambury

未读,
2007年2月23日 23:41:482007/2/23
收件人 Google-We...@googlegroups.com
Charlie? Anyone know?


--
Ian
http://roughian.com

charlie...@gmail.com

未读,
2007年2月26日 08:59:482007/2/26
收件人 Google Web Toolkit
Sorry, I was out of town the last few days. I have not run into a big
app yet, so I have not actually done this.

I asked Bruce this specific question though, because it comes up often
on the forums and it's certainly a legitimate issue (especially if you
are talking in concrete terms, such as 380k). Bruce said it was pretty
much seamless using history, explaining it as you simply cross the
boundary to the next part of your app, treating it as the "next" app.
I also asked if they had any plans to further address this area,
anything new, and he said no, he thought History pretty well handled
it.

In his demo he used History to go through a GWT app, into another GWT
app, and then back (using the back button) all the way out to a
different completely non GWT app.

So though I am short on details, because I have not personally run
into this, I think it is just basic History usage? I will try to come
up with an example over the next few days, but I think it is just a
matter of changing the history token programmatically (user clicks on
something where you want to have it cross boundaries into a new app, a
different tab or such), and then redirecting or forwarding the user to
the next app with history in tact (so they can go back if they
choose).

On Feb 23, 11:41 pm, "Ian Bambury" <ianbamb...@gmail.com> wrote:
> Charlie? Anyone know?
>

> On 21/02/07, Ian Bambury <ianbamb...@gmail.com> wrote:
>
>
>
> > That is great news, just use History support?
>
> > BTW for me, a big app is 380kb with OBF but without compression
> > (because it's not my server), without images, for a user on dial-up
> > (maybe not even on 56kbps) who is paying by the minute.
>
> > So how do I split my 380kb into smaller chunks using History support?
>
> > Ian
>

Bruce Johnson

未读,
2007年2月26日 12:01:572007/2/26
收件人 Google-We...@googlegroups.com
I'll try to distill it down to the a few main points, then we can tackle subsequent questions if this isn't clear enough.

1) Strive to combine code at the Java level instead of thinking in terms of multiple, separately-compiled modules. The best way to optimize for size is to combine modules together at the Java source level so that the compiler can optimize and obfuscate them together. The compiler has the most information about what you're trying to do, so more of the really cool global optimizations can be leveraged when you "stay in Java" as long as possible. This will essentially always be better than trying to include separately-compiled modules into the same page.

2) Never feel obligated to keep your GWT app to a single page. GWT history support works across pages. To see what I mean, do the following:
- Run the KitchenSink demo at http://code.google.com/webtoolkit/documentation/examples/kitchensink/demo.html
- Click through the first few vertical hyperlinks on the left side; observe that you are accumulating history events as you do this
- Go to google.com and search for anything; at this point, you've left KitchenSink and you're on a completely other page
- Click back 3 times to back into KitchenSink again; notice your history continues to work as if you'd never left the app
We describe this as "GWT history supports interstitial pages". Note that *you* have to do a good job of honoring history state changes in your app to make this work well, but the point is that the history infrastructure does the right thing.

3) Big apps should have history support. Generally speaking (exceptions exist, of course), if you have an app that's big enough to be "too big" for a single page, then the app is big enough to have some sort of history support. In and of itself, history is a really important usability feature. If you haven't really scrutinized it, check out how well Google Maps puts into sensible history support.

4) History is the answer to apps that are "too big". If you combine the points from #2 and #3 above, hopefully it makes sense that whenever you fear your app is becoming "too big" for a single page, all you need to do is split it into multiple pages such that each page has a unique module with a unique entry point. History smooths all the page junction points, and the compiler is smart enough to eliminate code you don't use from each page's entry point(s).

So, the reason we haven't prioritized ideas like piecemeal-loading subparts of modules is that we've never found a compelling reason to do something very complex when the algorithm above can actually take care of any real-world case we've been able to think of.

For more discussion on minimizing size, see
- http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/4df6f899632ae156
- http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/497f1f3008a27d74

-- Bruce

charlie...@gmail.com

未读,
2007年2月26日 14:10:142007/2/26
收件人 Google Web Toolkit
Thanks for the clarification sir, much appreciated.


On Feb 26, 12:01 pm, "Bruce Johnson" <b...@google.com> wrote:
> I'll try to distill it down to the a few main points, then we can tackle
> subsequent questions if this isn't clear enough.
>
> 1) Strive to combine code at the Java level instead of thinking in terms of
> multiple, separately-compiled modules. The best way to optimize for size is
> to combine modules together at the Java source level so that the compiler
> can optimize and obfuscate them together. The compiler has the most
> information about what you're trying to do, so more of the really cool
> global optimizations can be leveraged when you "stay in Java" as long as
> possible. This will essentially always be better than trying to include
> separately-compiled modules into the same page.
>
> 2) Never feel obligated to keep your GWT app to a single page. GWT history
> support works across pages. To see what I mean, do the following:

> - Run the KitchenSink demo athttp://code.google.com/webtoolkit/documentation/examples/kitchensink/...

> -http://groups.google.com/group/Google-Web-Toolkit/browse_thread/threa...
> -http://groups.google.com/group/Google-Web-Toolkit/browse_thread/threa...
>
> -- Bruce

Ian Bambury

未读,
2007年2月26日 14:19:382007/2/26
收件人 Google-We...@googlegroups.com
Hi Bruce,
 
I think I must be missing something. Here's my take:
 
1) I have only one module
 
2) I don't feel obligated to a single page, but if I have a second page, I have to start everything all over again, so a single page would be useful. GWT loses it's usefulness and is pretty pointless if instead of using Ajax, I go back to the server and get another page.
 
3) History support is all well and good, but using history to change from displaying one panel back to seeing the one before doesn't reduce the size of my app, just increases it very slightly because I have to include the code for history support.
 
So I have an app, one page, one entry point, displaying one lazy-loaded panel at a time (out of say 60). I've increased the amount of code to include history support for the back and forward button. I now have a 380kb cache.html file.
 
Sorry if I am being thick here, but how can using history let me to reduce the 380kb?
 
Cheers,
 

charlie...@gmail.com

未读,
2007年2月28日 21:30:172007/2/28
收件人 Google Web Toolkit
You would have to use multiple modules to reduce the size, and then
History can help make the transition between pages/modules seamless.
That is what I read in Bruce's response?

"whenever you fear your app is becoming "too big" for a single page,
all you need to do is split it into multiple pages such that each page
has a unique module with a unique entry point. History smooths all the
page junction points"

Ian Bambury

未读,
2007年2月28日 23:44:322007/2/28
收件人 Google-We...@googlegroups.com

OK, let's see if I've got it right...

"The best way to optimize for size is to combine modules together because GWT can use really cool optimisation techniques."

Right! So I combine the modules, yeah?

Wait a minute, Charlie says "use multiple modules to reduce the size"

So which is it Bruce? 
 
"All you need to do is split it into multiple pages such that each page has a unique module with a unique entry point"

Right, so loads of pages, loads of modules, loads of entry points, and everything is cool, hip, and groovey.

In my best Samuel L. voice ... "Example?"
 
"You know what they call a Kitchen Sink Demo in Paris?"

"They don't call it a Kitchen Sink Demo?"

"No, they got the metric system over there, they wouldn't know what the **** a Kitchen Sink is. But you're not French, so have a look at it."

OK, let's have a look, then. Multiple pages, loads of modules, more entry points that a Texas whorehouse, yeah?

Well, no. One page, one module, and one entry point.

Why, Bruce, why? Well because "this will essentially always be better than trying to include separately-compiled modules into the same page"

But you said...OK, I'm confused, but this is a History-based thread, let's forget that for a while. Tell me about History.

"History is the answer to apps that are 'too big'"

Yippee! Example?

"Le Kitchen Sink Demo"

Ah.

"Click through the first few vertical hyperlinks on the left side; observe that you are accumulating history events as you do this. Go to google.com and search for anything ;"

OK, done that. How is this demonstrating application size reduction?

"At this point, you've left Le Kitchen Sink and you're on a completely other page"

I was wondering about that.

"Click back 3 times to back into KitchenSink again; notice your history continues to work as if you'd never left the app"

Apart from losing everything I typed in, the tabs being reset, and the checkboxes and radio buttons losing state, that is perfectly true, yes.. All very clever, but how does this reduce the size of my *.cache.html files?

"Big apps should have history support"

OK...because?

"If you have an app that's big enough to be "too big" for a single page, then the app is big enough to have some sort of history support"

Is it really. Well I never. And presumably the converse is true, or why mention it: if it's not big enough to be "too big" then it's not big enough to have any sort of history support. There's logic for you. This is very interesting but it's not reducing the size of my *.cache.html files, is it? Is it possible for you to get to the point, please, my friend.

"history is a really important usability feature"

I know.

"History smooths all the page junction points"

That's nice. I hate rough page junction points. I always have. A rough junct...sorry, carry on.

"The compiler is smart enough to eliminate code you don't use from each page's entry point(s)."

It's not smart enough not to include the tree gifs if I don't use the tree widget, though, but I'll take your word for it. Is that it?
 
Yep. "The algorithm above can actually take care of any real-world case we've been able to think of"

So I think I've nearly got it now. Just one more thing, sir... What do I do to reduce the size of my app's files?

 

charlie...@gmail.com

未读,
2007年3月1日 09:47:022007/3/1
收件人 Google Web Toolkit
The step 1 that Bruce outlined, as I read it, was get all your stuff
into one module and let the compiler do the optimizations. The other
steps were if that still ends up "too big", change directions and
split it into different modules. These were not contradictory, they
were two different approaches.

And as for "Apart from losing everything I typed in, the tabs being


reset, and the
checkboxes and radio buttons losing state, that is perfectly true,

yes.." Actually no, not at all, that is precisely why you would use
History.

As I said to begin with I do not personally have an example because I
have not had this problem - I was just trying to pass along what Bruce
said (and I think his comments were helpful, you appear to have taken
them a bit differently.)

> google.comand search for anything

Ian Bambury

未读,
2007年3月1日 10:29:392007/3/1
收件人 Google-We...@googlegroups.com
On 01/03/07, charlie...@gmail.com <charlie...@gmail.com > wrote:

The step 1 that Bruce outlined, as I read it, was get all your stuff
into one module and let the compiler do the optimizations.  The other
steps were if that still ends up "too big", change directions and
split it into different modules.  These were not contradictory, they
were two different approaches.
 
"The answer to apps that are too big is to combine the modules" and "The answer to apps that are too big is to split it into separate modules" isn't contradictory?
 
So what you're saying is that when I was told "History is the answer to apps that are 'too big'" what was really meant was "If it's too big, have two completely separate pages". Hardly bleeding edge, ground-breaking stuff is it? Going back to the server for a completely different page is not Ajax and has nothing to do with GWT's History support which just lets you use history to change where you are in a single GWT page, the browser moves you between real pages.
 
And as for "Apart from losing everything I typed in, the tabs being
reset, and the
checkboxes and radio buttons losing state, that is perfectly true,
yes.."  Actually no, not at all, that is precisely why you would use
History.
 
Well, when I go to the KS demo and type something in a text box, then go  to Google, and then press the back button, the text disappears. What am I doing wrong?

As I said to begin with I do not personally have an example because I
have not had this problem - I was just trying to pass along what Bruce
said (and I think his comments were helpful, you appear to have taken
them a bit differently.)
 
I'm sure that Bruce is trying his best to be helpful (and to humour me the best he can), it's just that no-one has told me anything which I can use to reduce the overall size of my *.cache.html files - if all anyone is saying is "put it all in one module, or if it is too big put it in more than one module" they are not telling me anything I can't work out for myself.
 
Ian

Reinier Zwitserloot

未读,
2007年3月1日 11:46:102007/3/1
收件人 Google Web Toolkit
Ian: You had a few too many cups of coffee, I take it? In that case
(but only in that case) you are excused from your belligerent
behaviour.

There are a load of totally different issues running haywire here, so
let me try and address each:

First, terms and definitions:

HISTORY: Large apps should probably 'have it', but this by no means
helps, addresses, or is even tangentially related to reducing the
latency and/or bandwidth issues for large GWT apps.

MULTIPLE MODULES: You can have multiple modules, and have GWT compile
the lot down to 1 'web app'. However, only one of those modules may
have an entry point. Using 'library modules' is NO PROBLEM IN GWT - if
you use 1% of a module's features (say, only 1 simple widget from the
gwt-wl extension), GWT simply only compiles in that 1%, and the
remaining 99% simply never arrives. Hence, do NOT try to squash
multiple modules into a single one to reduce footprint, it doesn't do
jack except make your project an unmaintainable turd. Just Don't.

MULTIPLE MODULES WITH MULTIPLE ENTRYPOINTS: Usually this refers to the
idea that you 'lazy load' parts of the app: Have 2 or more essentially
completely separate (and thus separately compiled) gwt apps, and let
one open the other, say, in an iframe. This almost never works. While
you may address app load latency with this tactic, the total number of
bytes transferred increases significantly (the 'second' app reloads a
lot of logic already loaded in the first, and there's no practical way
to avoid that from happening). If you mean having multiple entrypoints
in 1 or more modules and compiling all this to 1 gwt app: That can NOT
BE DONE, period.

FOOTPRINT REDUCTION: This is the central idea that the 'app takes too
long to load'. Unfortunately, that is totally pointless information.
That's because there are a couple of, wholly separate, issues.

1. RUNNING BANDWIDTH: This refers to bandwidth that a client needs in
order to comfortably work with the GWT app once it's already loaded.
If, for example, you have some huge grid that gets updated every 5
seconds, that's a phat pipe requirement right there. That's something
GWT can't help you with directly, you'll just have to get smarter
about caching stuff. Entirely your show, there are no libraries here
that help you much. This applies only to apps that use GWT-RPC (or
RequestBuilder) a lot. Check e.g. gpokr, which has low running
bandwidth, but it is there (the chat and cards data is continuously
sent).

2. INITIAL BANDWIDTH: This refers to the number of kilobytes that gets
sent down the pipe to someone with a clean cache. Note that GWT is
very smart with caching (if nothing changed, then only a tiny file is
reloaded, the rest can come from browser cache, and usually does). GWT
apps fall somewhere in the 150k to 900k load, which is ridiculously
small for large webapps. Even a huge GWT app ends up being relatively
small. In short: Don't worry about it. Where this doesn't work, check
if you have huge tables in code someplace, and load those in a
different, more dynamic way. Splitting up the code base to lazy-load
is difficult and usually fruitless. To figure out exactly how much
bandwidth is used by your app, get firebug (getfirebug.com) for
firefox and check the 'net' tab for a nice overview of what gets
loaded when a user navigates to your GWT app.

3. INITIAL LATENCY: This refers to the amount of time the browser is
effectively idling, waiting for a request or two to make their way
across e.g. an atlantic cable. The primary reason for latency problems
is having a metric buttload of images. The solution for this is
'ClippedImage', a neat trick available in GWT 1.4. Read all about it
at Robert's blog here: http://roberthanson.blogspot.com/2007/02/gwt-clippedimage-optimizing-image.html.
To solve this, make stuff as monolithic as you can: A single image
instead of a tonne, a single CSS sheet, a single huge JS file with all
the libraries you've used in there, etcetera. GWT 1.4 will help. Also
check the *.gwt.xml format for including external js files in the
monolothic gwt-generated JS. Check the net tab of firebug, again, to
see latency delays in action. And see Robert's blog, he explains why
monolithizing stuff works so well in making the app load faster.

4. LOAD FREEZE: While GWT is actually running, the web browser is
effectively frozen. If you actually 'render' ALL of your web-app's
content (create the panels, buttons, labels, images, checkboxes,
choiceboxes, grids, tables, textboxes, forms, blablabla) then the
browser can take many seconds just hanging there. The solution to this
problem is simple: lazy rendering. The idea being that you render
stuff only when it gets actually drawn. Check the kitchen sink.

MISCONCEPTIONS:

There are at least 4 DFHAJSFHASwtfAreAllTheseLettersForSDFJASDJHD.html
files generated during compilation. Well, those letters are hashes of
all relevant methods of that particular compilation run (the idea
being, if nothing changes, the browser grabs the cached version
instead, but if you change something, that the changes propagate
immediatly without all your users having to clear cache first. It's a
nifty system. Say 'oooooooh!' and move on). The rub is: Each of those
files is a specific version for a specific browser. One of them is for
IE, one for safari/webkit, one for opera, and one for the firefox/
gecko. ONLY ONE OF THOSE is downloaded by each client, not ALL OF
THEM. Yet again, see your local firebug net tab to confirm this.


Now please stop being a buffoon, though I admit your, um, inspired
writing at least deserves points for trying to write an enjoyable
flame.

And be more specific in what your problem is.

Reinier Zwitserloot

未读,
2007年3月1日 11:52:002007/3/1
收件人 Google Web Toolkit
oh, and just to add to this: If you need an app that can be 'entered'
in multiple ways, then there's a simple solution.

Just to explain what I mean: Say to register as a new user, you just
fill in an email address. Then, the 'activation link' mail that gets
sent to you takes you to a page where you fill in your name, preferred
password, etcetera, and from there on you go straight to the 'logged
in' homepage. Thus this app really has 4 different 'entry points':

1. No cookie at all: Some sort of 'hey, welcome, how's life, my app
r00lz, join up, puhlease' thing.
2. A cookie, which after an RPC call doesn't appear to be valid, OR a
cookie of the type: The guy logged out manually but he's been here
before (note that you need to make these cookies yourself with e.g.
Cookies.setCookie). Here you show a 'log in' thing.
3. Cookie is there, and valid, go straight to already logged in page.
4. The guy clicked the activation link.

In all cases you can just start at the main entrypoint. Case #1, #2
and #3 are differentiated by way of cookies and some tactical RPC
calls.

Case #4 can be differentiated by checking the location URL
(WindowUtils has it, I think). e.g. while GWT is a totally static
show; it's just html and js files, you can still make a link of the
type:

http://www.myserver.com/mygwtapp.html?actkey=1239420948

- just that the server doesn't do anything with that actkey. Still,
it's in the URL (unless your apache or tomcat or jetty or whatnot is
configured to redirect, so don't do that) which you can query on the
client side (read: in GWT). Thus GWT can get at that 'actkey' thing,
realize what's going on (clicked activation link), and GWT-RPC or
RequestBuild your way out of it, and show the right screen.

Note that for this one app with 4 different entry use cases, you can
address it all with just 1 actual 'entrypoint' which does some checks
on the URL and on the cookies.

> at Robert's blog here:http://roberthanson.blogspot.com/2007/02/gwt-clippedimage-optimizing-....

Dan Morrill

未读,
2007年3月1日 13:35:412007/3/1
收件人 Google-We...@googlegroups.com

This thread's become confusing to me, and I'm not sure if there are any open questions here or not.  So, I'll throw in my US$0.02, and if there are any open questions after that, it might help to start up a new thread. :)

I think can summarize Bruce's suggestion (which I would describe as a "best practice" more than anything else) as:
  • Don't assume up-front that just because your directory contains 1 MB of data that browsers have to download 1 MB before they can start a GWT app.
  • As a corollary to the above, don't assume up-front that GWT's output will be inadequate.  Try it first, and be sure it's worth the effort before you jump through hoops.  In our experience, it hasn't been worth it yet.  Your mileage may vary, but if it does let us know the details!
  • If, in the unlikely case where you DO need some kind of partitioning, the idea is to split your application down the middle with a butcher knife, and put each half in its own module and host page (URL).  You'll need to choose where to cut, to make each "half" capable of handing off control to the other, transparently.
  • Use History support and careful page re-loading to hand off state between the application "halves".
It's as simple and as complicated as that.  It's tricky enough that you should only embark on it if you really need to -- our experience is that it's usually not necessary.

I don't know if any of that helped or not, but... I hope it did. :)

- Dan

Ian Bambury

未读,
2007年3月1日 14:00:182007/3/1
收件人 Google-We...@googlegroups.com
No flame was intended. Apologies to anyone who managed to get the idea I was deliberately insulting them.
 
Perhaps, like you, I would do better to call them "buffoons".
 
Reinier, you say:
 
HISTORY:  Large apps should probably 'have it', but this by no means helps, addresses, or is even tangentially related to reducing the latency and/or bandwidth issues for large GWT apps
 
Bruce says:  History is the answer to apps that are "too big".
 
You say:
MULTIPLE MODULES: You can have multiple modules, and have GWT compile the lot down to 1 'web app'.
 
Example? I can't do this. And what use is it? I would have said that one module WAS one web app.
 
However, only one of those modules may have an entry point.
 
Well, I would have thought that every module would have to have at least one entry point or how else do you get into it? Plus I've got modules with more than one entry point which work quite happily.
 
MULTIPLE MODULES WITH MULTIPLE ENTRYPOINTS: Usually this refers to the idea that you 'lazy load' parts of the app: Have 2 or more essentially completely separate (and thus separately compiled) gwt apps, and let one open the other, say, in an iframe.
 
Well, the KS is held up as an example of lazy loading and it doesn't do this, it creates content on the fly within one module and doesn't use iframes for it.
 
This almost never works. While you may address app load latency with this tactic, the total number of bytes transferred increases significantly (the 'second' app reloads a lot of logic already loaded in the first, and there's no practical way to avoid that from happening).
 
Sorry, http://write.roughian.com loads into iframes. It works. The iframe pages run off the main page cache.html files, and the nocache.html file gets a 304. Anything in it that appears when you click a tab is loaded in an iframe.
 
GWT apps fall somewhere in the 150k to 900k load, which is ridiculously small for large webapps.
 
Maybe for you, and maybe you don't care about people on dial-up who pay by the minute. Not everywhere in the world has access to DSL and not everyone can afford it. 900kb at 28.8kbps is in the region of 6 minutes. It may be ridiculously small to you but it takes a long time for them.
 
Cheers,
 
Ian

Ian Bambury

未读,
2007年3月1日 15:42:442007/3/1
收件人 Google-We...@googlegroups.com
I just read that back and realised that it *could* be taken that I *was* now calling people who had managed to feel flamed by my post previous to the one previous to this, 'buffoons'. That was not iintended either.

 

Reinier Zwitserloot

未读,
2007年3月1日 15:59:442007/3/1
收件人 Google Web Toolkit

On Mar 1, 8:00 pm, "Ian Bambury" <ianbamb...@gmail.com> wrote:
> Bruce says: History is the answer to apps that are "too big".
>

Bruce was... well, not wrong, but for the sake of argument let's say
that he was. In the sense that with what you are doing, don't look at
history. If you absolutely must go with multiple separately compiled
GWT apps that are patched up together, history is one way to
communicate back and forth, but, yuck. That's the absolute last
resort.

>
> Example? I can't do this. And what use is it? I would have said that one
> module WAS one web app.
>

Any GWT app - you 'include' com.google.gwt.user.User, don't you?
Actually, "User" is just a combotarget that includes 8 or 9 other web
apps (search the source tree for User.gwt.xml, check it out). The use
is obviously the same use for GWT itself: The ability to partition
your code. If you e.g. have an admin interface and a client interface,
you can toss the common bits into a 'common' project, the client bits
in a client project, and the admin bits in an admin project, with the
client and admin projects 'including' the common project.

Normally in JS land that sucks, because it implies the bits that are
included but unused take up valuable bandwidth/latency, but in GWT,
the compiler just doesn't add whatever isn't used. Joy.

> Well, I would have thought that every module would have to have at least
> one entry point or how else do you get into it? Plus I've got modules with
> more than one entry point which work quite happily.

You don't, you just use the classes. com.google.gwt.user.User has no
entry point. Neither does the gwt-wl extension. Neither does that
'common' hypothetical project I mentioned before.

>
> Well, the KS is held up as an example of lazy loading and it doesn't do
> this, it creates content on the fly within one module and doesn't use
> iframes for it.
>

KS does lazy building/rendering, not lazy loading. However, sometimes
'lazy building' or 'lazy rendering' is called 'lazy loading' which is
confusing, but there you have it.

>
> Sorry,http://write.roughian.comloads into iframes. It works. The iframe


> pages run off the main page cache.html files, and the nocache.html file gets
> a 304. Anything in it that appears when you click a tab is loaded in an
> iframe.
>

It doesn't "work" in the sense that it doesn't actually make your app
load any faster. You can make it fysically be not buggy, obviously.
It's the last resort and it's not pretty. Don't.

> Maybe for you, and maybe you don't care about people on dial-up who pay by
> the minute. Not everywhere in the world has access to DSL and not everyone
> can afford it. 900kb at 28.8kbps is in the region of 6 minutes. It may be
> ridiculously small to you but it takes a long time for them.

You're talking out your ass. For one, which idiot would want to use a
heavy web app @ 29.8 kbs? This is 2007! Check out digg (3MB homepage),
or gmail, and you'll find that 1MB is on the low end.

If you have 'special needs', why in @%#$*(#$'s name are you using a
wrapper toolkit? OBVIOUSLY you'll have to hand code the javascript
with painstaking detail if you want the absolute least amount of code
download. You'll probably multiply dev times (and buggyness) by a
factor 10 while you're at it, but, hey. I want a pony too.

What you want; Splitting the module up will not be kind to dailuppers
or by-the-minute folk, because it's actually MORE SHIT TO DOWNLOAD.
It's just that the downloads are spread out more instead of having to
be done up front, which might create the impression that the app is
somewhat more responsive. It might be slightly less if they don't do
anything after the page load, but don't you think it makes waaay more
sense to make a separate (probably not GWT based) 'view' page where
you can get some simple views on the data suitable for e.g. the tiny
display of a mobile phone? Trying to make one GWT app work for
everything is retarded.

>
> Cheers,
>

Indeed. At this point I'd just like to state that everyone has been
either answering your exact question point blank (which confused you),
or advising you, STRONGLY, *NOT* to try to split up your app in twain
and use some sort of iframes arrangement with communication through
history tokens. Given that those who gave that advice are far more
skilled at using GWT than you, please take a moment to think of a term
that adequately covers your current insistence on ignoring it. I've
already given it a shot but your negative reaction to said term seems
to indicate I may have been way off the mark. So I'll let you come up
with your own term for your current behaviour.

Cheers!

Ian Bambury

未读,
2007年3月1日 18:04:482007/3/1
收件人 Google-We...@googlegroups.com
On 01/03/07, Reinier Zwitserloot <rein...@gmail.com> wrote:
> On Mar 1, 8:00 pm, "Ian Bambury" < ianbamb...@gmail.com> wrote:
> > Bruce says:  History is the answer to apps that are "too big".
> >
>
> Bruce was... well, not wrong, but for the sake of argument let's say
> that he was. In the sense that with what you are doing, don't look at
> history.


Reinier, I can only go by what is said. If someone from the Google GWT development team says that History is the answer to the problem of large (my definition of 'large') GWT applications, then I'm sure that you would be one of the first to call me a fool (or worse) for deciding that I was going to ignore the advice he seemed to be offering.

> If you absolutely must go with multiple separately compiled
> GWT apps that are patched up together, history is one way to
> communicate back and forth, but, yuck. That's the absolute last
> resort.

I don't have multiple separately compiled GWT apps that are patched up together, I have one application which is larger than I would like. The one using iframes was developed just as a proof of concept. I also have another which loads into iframes and then attaches code to the DOM of the parent frame. It is also just an experiment.

> > Example? I can't do this. And what use is it? I would have said that one
> > module WAS one web app.
> >
> Any GWT app - you 'include' com.google.gwt.user.User , don't you?


Yes I do, of course, include com.google.gwt.user.User, but I wouldn't call it an 'application' as such since it is not a program or group of programs designed for end users of any kind.

>
> > Well, I would have thought that every module would have to have at least
> > one entry point or how else do you get into it? Plus I've got modules with
> > more than one entry point which work quite happily.
>
> You don't, you just use the classes. com.google.gwt.user.User has no
> entry point. Neither does the gwt-wl extension. Neither does that
> 'common' hypothetical project I mentioned before.


Exactly, I'm just using the classes, I can't run com.google.gwt.user.User
 
Can you write a GWT app (i.e. a module as defined by a gwt:module meta tag) which runs but does not include a class with "implements EntryPoint"? Because then you have created a module without an entry point and managed to run it. I can't do that.

I can write one with two "implements EntryPoint" classes, though, which you say can't be done. It runs, and I am not just using the classes in something else. It's a module (i.e. a module as defined by a gwt:module meta tag) and it has two entry points.

I still reckon that every gwt module needs an entry point and that one module can have more than one of them.


> > Well, the KS is held up as an example of lazy loading and it doesn't do
> > this, it creates content on the fly within one module and doesn't use
> > iframes for it.
> >
>
> KS does lazy building/rendering, not lazy loading. However, sometimes
> 'lazy building' or 'lazy rendering' is called 'lazy loading' which is
> confusing, but there you have it.

The GWT team describe it as lazy-loading. If you wish to use a different definition from them without explaining that you are effectively redefining the word (or what your alternative definition is), then you are going to confuse at least a few people on the list.

> > Sorry,http://write.roughian.comloads into iframes. It works. The iframe
> > pages run off the main page cache.html files, and the nocache.html file gets
> > a 304. Anything in it that appears when you click a tab is loaded in an
> > iframe.
> >
>
> It doesn't "work" in the sense that it doesn't actually make your app
> load any faster.


Yes it does. The amount of data required to display the initial page is less than the amount of data required to display the initial page and one other which is less than the amount required to display everything available on the site, therefore the initial load of the application is faster and the load time for someone not looking at the whole site is faster than if the whole site were combined into one application.. I can add text to a sub-page without increasing the size of the initial load or any other page load unless you choose the changed page.

>
> > Maybe for you, and maybe you don't care about people on dial-up who pay by the minute. Not everywhere in the world has access to DSL and not everyone  can afford it. 900kb at 28.8kbps is in the region of 6 minutes. It may be ridiculously small to you but it takes a long time for them.
>
> You're talking out your ass. For one, which idiot would want to use a
> heavy web app @ 29.8 kbs? This is 2007! Check out digg (3MB homepage),
> or gmail, and you'll find that 1MB is on the low end.


Thank you for that non-confrontational comment. My point is not that users on a slow connection should be able to use massive applications instantly (nice though this would be). My point is that any reduction in the time taken for the initial download is good. For pretty much anyone. If I can have a 50kb initial app plus three 50kb separately downloadable but integrated modules which are downloaded only if required, then everyone wins.
>
> What you want; Splitting the module up will not be kind to dailuppers
> or  by-the-minute folk, because it's actually MORE SHIT TO DOWNLOAD.
> It's just that the downloads are spread out more instead of having to
> be done up front, which might create the impression that the app is
> somewhat more responsive.

Okaaaay...(we'll ignore tha fact that you think giving the impression of a faster download is not beneficial) ....so I download the initial page and log in, say 50kb. Then I go to the house insurance section and the app downloads the extra code required for that (please note, I'm not talking about a complete stand-alone web page here or an iframe or anything else which will run by itself) say another 50kb. 100kb in total. That's all I do. I don't download the motorcycle insurance(50kb), car insurance(50kb), marine insurance(50kb), commercial property insurance(50kb), pet insurance(50kb), commercial liability insurance(50kb), home contents insurance(50kb), holiday insurance(50kb), investment risk insurance(50kb), public liability insurance(50kb), or any other kind of insurance(at 50kb a shot) units.

So my 100kb is somehow, according to you, "MORE SHIT TO DOWNLOAD" than if I downloaded everything? Care to explain?


> At this point I'd just like to state that everyone has been
> either answering your exact question point blank (which confused you),
> or advising you, STRONGLY, *NOT* to try to split up your app in twain


State away. No-one has answered how to use history to reduce file size.

> Given that those who gave that advice are far more
> skilled at using GWT than you, please take a moment to think of a term
> that adequately covers your current insistence on ignoring it.


I'm not ignoring it, I'm asking for someone to explain it.

If you look at my posts while I have been on this list, you will see that I rarely ask questions but try my best to answer those of others if I feel I can help them. I hope that occassionally I succeed.

I was rather hoping that my enquiry would be answered in a similar fashion by someone who knows more than I do in this area, but what I have got is you: I get called a buffoon, you imply that I am an idiot, you tell me I'm 'confused', you call me 'retarded', and say "You're talking out your ass."
 
Does your opinion of me tell people things about me? Or does it tell people things about you?
 
Cheers,

Ian
已删除帖子

Luciano Broussal

未读,
2007年3月5日 05:49:422007/3/5
收件人 Google Web Toolkit
Hi all,

Only fair guys are admitted on this forum :) no battle on this forum.
Only guys in the same way for making the GWT technology growing and
growing more and more and crunching the old manner to deal with ajax
process :)

Cheers.

Luciano

On Mar 2, 12:04 am, "Ian Bambury" <ianbamb...@gmail.com> wrote:


> On 01/03/07, Reinier Zwitserloot <reini...@gmail.com> wrote:
>
> > On Mar 1, 8:00 pm, "Ian Bambury" <ianbamb...@gmail.com> wrote:
> > > Bruce says: History is the answer to apps that are "too big".
>
> > Bruce was... well, not wrong, but for the sake of argument let's say
> > that he was. In the sense that with what you are doing, don't look at
> > history.
>
> Reinier, I can only go by what is said. If someone from the Google GWT
> development team says that History is the answer to the problem of large (my
> definition of 'large') GWT applications, then I'm sure that you would be one
> of the first to call me a fool (or worse) for deciding that I was going to
> ignore the advice he seemed to be offering.
>
> > If you absolutely must go with multiple separately compiled
> > GWT apps that are patched up together, history is one way to
> > communicate back and forth, but, yuck. That's the absolute last
> > resort.
>
> I don't have multiple separately compiled GWT apps that are patched up
> together, I have one application which is larger than I would like. The one
> using iframes was developed just as a proof of concept. I also have another
> which loads into iframes and then attaches code to the DOM of the parent
> frame. It is also just an experiment.
>
> > > Example? I can't do this. And what use is it? I would have said that one
> > > module WAS one web app.
>

> > Any GWT app - you 'include' com.google.gwt.user.User, don't you?

> > > Sorry,http://write.roughian.comloadsinto iframes. It works. The iframe

回复全部
回复作者
转发
0 个新帖子