MVP framework(s) doubt

108 views
Skip to first unread message

vehdra music

unread,
Nov 26, 2011, 10:42:21 AM11/26/11
to Google Web Toolkit
I am creating a GWT application using GWT MVP as described here
( http://code.google.com/webtoolkit/doc/latest/DevGuideMvpActivitiesAndPlaces.html
) only that instead of ClientFactory I am using Gin.

I started nice, but now that I have many entities with List & Edit
views, activities and places, my project is growing a lot and I having
perfomance issues.

I know about code splitting, but I care about is, is performant to
have for example a EditPlace, ListPlace, EditActivity & ListActivity
for every model that I need to work in my app? For example, if I only
have Foo model I will have:

FooEditPlace
FooEditActivity
FooEditView
FooEditViewImpl
FooEditView.ui.xml

FooListPlace
FooListActivity
FooListView
FooListViewImpl
FooListView.ui.xml

Ten files for only editing / listing one model :) And I have to edit /
list about 17 models in my app right now...

I don't know if I doing the things in the "right" way. Is it normally
to have many files in a big GWT project using the GWT Activities &
Places fw?

OTOS I was looking to another frameworks like gwtp, mvp4g, guit, every
one seems to be nice and have cool features, but I believe (just
believe, I didn't try anyone of this fw yet) that they are reinvent
the wheel. Or I am wrong and I can take avantage of using one of this
fw in my app?

What are you experiences? Am I doing wrong in the "Activities &
Places" way? Am I using it right and I just have to use code spliting
to have better performance? Or should I use gwtp, mvp4g or guit?

Thanks in advance ;)

Travis Camechis

unread,
Nov 26, 2011, 10:56:56 AM11/26/11
to google-we...@googlegroups.com
I have used GWTP a project I worked on and loved it.  It doesn't require all the boiler plate code that you have to write use the ActivitiesAndPlaces model. 


--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.


Christian Goudreau

unread,
Nov 26, 2011, 11:19:03 AM11/26/11
to google-we...@googlegroups.com
I've used activities and places are great "tools", not a framework in itself. It can be used for mvp, but doesn't has to. What is missing with activity and places is a framework like Gwtp that remove all the boiler plate from it :D

That being said, I would suggest using gwtp (since I'm one of the owner and dedicated to it). I never used mvp4g, but I know Pierre-Laurent and he's really active and dedicated to his project. Guit is also a really good framework, there's a lot of magic behind it that remove a lot of boiler plate, even more than it Gwtp and mvp4g.

Gwtp community is really active and you'll get a lot of help from the members, my company is also offering consulting and development services on top of gwt and gwtp and is dedicated to support Gwtp for businesses that need long term involvement in the project.

By the way, Gwtp, mvp4g and guit doesn't reinvent the wheel, they existed long before Activities and places :D And as for Gwtp, next version is focused toward better integration with Activities and places.

Cheers,
--
Christian Goudreau

Thomas Broyer

unread,
Nov 26, 2011, 12:31:12 PM11/26/11
to google-we...@googlegroups.com
What are your perf issues? Are they in DevMode or production mode? If you don't have perf issues in prod mode, then you don't have a perf issue: DevMode *is* slower; and moreover code splitting won't help.
It's also important to define *which* are your perf issues: if it's download time, then code splitting can help, if it's about "runtime" performance, then it won't, and you'll have to find the bottleneck.
Having a lot of classes can be the problem, but I highly doubt it is.
We do have thousands of classes, and we use RequestFactory and the Editor framework, which generate a whole lot more, and we haven't had any negative feedback (yet) about performance.

If you want to reduce the number of files you have, then you can cut the number of places by using, say an EditPlace with a field telling which kind of "entity" is being edited, of a FooPlace with a field telling which "action" is being done on the Foo entity (edit, list, etc.) But I doubt it'll change much things about performance (and unless you measure it and determine it's your bottleneck, it's not worth trying to "fix" it).

So, first, if you have a perf issue, measure and determine where it comes from (you can use SpeedTracer in Chrome, or any browser's profiling tool; possibly after compiling in -style PRETTY so the code is readable, even if less optimized; you can also use the Duration class and some logging, using GWT.log() in DevMode or java.util.logging), then fix it. But without *knowing* (not only guessing, knowing!) what your perf issue is, it's likely you won't fix it just by trying a few things (and you could even make it worth, if you guessed wrong).

Also, keep in mind that any framework that "cuts boilerplate down" uses code generation, so you might have fewer classes in your code, it doesn't mean there'll be less in the end (only the compileReport will tell you).

Generally, bottlenecks are: DOM manipulations (misuse or overuse of widgets; switch to HTMLPanel and CSS for layout if possible, use Cell widgets for lists/tables/trees), and RPC (GWT-RPC or RequestFactory, or whatever; serialization is generally the culprit); and of course server-side code (database, etc.)

vehdra music

unread,
Dec 3, 2011, 3:43:45 PM12/3/11
to Google Web Toolkit
Sorry about the delay :)

The main issue that I am having is in Eclipse, something when I make a
change (little change) and I reload my app in Firefox I get this on
the console:

java.lang.OutOfMemoryError: PermGen space
[ERROR] Out of memory; to increase the amount of memory, use the -
Xmx flag at startup (java -Xmx128M ...)

So that's why I believed that cutting the number of classes could
solve my problem.

BTW i am on MacBookPro i5 with 4MB, using Eclipse Helios 64 bit.

Shawn Brown

unread,
Dec 3, 2011, 5:59:39 PM12/3/11
to google-we...@googlegroups.com
I think you have no problem.

> Sorry about the delay :)
>
> The main issue that I am having is in Eclipse, something when I make a
> change (little change) and I reload my app in Firefox I get this on
> the console:
>
> java.lang.OutOfMemoryError: PermGen space
>   [ERROR] Out of memory; to increase the amount of memory, use the -
> Xmx flag at startup (java -Xmx128M ...)
>
> So that's why I believed that cutting the number of classes could
> solve my problem.

Completely unnecessary.

Just right click your project in eclipse and select -->run as --> run
configurations.

Under Web Applications find the html page for your project, select it
and do what the message above says to do in the vmargs tab.

If Eclipse itself need more memory you have to find the icon in finder
and right click it, select Show Package contents --> MacOS --> and
modify with something like the following under -vmargs:


-vmargs

-XX:MaxPermSize=1G
-Xms40m
-Xmx2G

Reply all
Reply to author
Forward
0 new messages