Designing a plugin-ready application with GWTP

29 views
Skip to first unread message

PhilBeaudoin

unread,
May 14, 2010, 1:05:43 PM5/14/10
to GWTP
The following question was asked as a comment on the GettingStarted
page, and I thought it might be interesting to discuss it here:

-------------
From charming30:

I have a large project on Google AppEngine Python which I am
rebuilding in Java. For this I started with MVP4G (MVP Framework),
which is pretty easy and good so far, but after I saw GWTPlatform, I
am realizing what all I have missed. I have to migrate my MV4G code to
GWTPlatform or rewrite from scratch. Its certainly looks promising and
advanced.

My criteria is: I would like to build a platform where eventually
hundreds of apps will be added to it (on web and clients from mobile).
Hence I am looking for a very clean modular design like pacakages in
java. Is that possible in GWTPlatform? The puzzlebazar example is
great, but the kind of project I am building will have many small apps
like puzzlebazar within it and will act like a platform with user
personalization etc.

If anyone can confirm this kind of project is possible with
GWTPlatform and any pointers if possible, I would dive in and be ever
grateful. Any advice would be greatly appreciated.

PhilBeaudoin

unread,
May 14, 2010, 1:06:21 PM5/14/10
to GWTP
Regarding your question of running multiple "plugins" in the same app,
my answer will be in multiple parts: (note: I use plugins instead of
"apps" or "modules" for clarity)
1) This is definitely something I want to do. I'd like PuzzleBazar to
be extensible without having to recompile the entire app, so that new
types of puzzles can be added easily, or developed by third parties.
2) I don't know how I will do this yet. In fact, I don't even think
it's possible with GWT. Code splitting is nice, but it's not yet
controllable to the point where you can load "plugins" manually. I
wouldn't be surprised if such a feature was coming in the near future,
but I haven't followed this too much.
3) That being said, one approach that works now would be to use a
different base url for your different plugins. That would require
reloading the webapp when you switch from one plugin to another, but
as long as you stay within a plugin you have all the benefit of a
webapp.

Say you were considering option (3). I haven't thought about it
thoroughly, but I believe that GWTP would work well in such a
scenario. If some of the presenters appear in all plugins, you could
reuse the presenter classes (bind it in the ginjector module of all
the plugins that need it). The server side can easily have a shared
dispatcher (for global actions, like fetching the user) and
plugin-specific dispatchers (for plugin-specific actions).

It is entirely possible that I'm overlooking something, but I'm fairly
confident that there are no show-stopper for option (3) in GWTP. If
something is missing, I will definitely consider adding it -- or you
can even contribute it yourself.

4) If you don't mind recompiling the webapp each time a new "plugin"
is available, then you fall right on the typical use case of GWTP. I
have (tried) to design it to be very efficient with tons of
presenters. Presenters are loosely coupled, they can be code splitted,
etc. This means you can add as many plugins as you want, the loading
time for your app should barely increase. In your case, a new plugin
would be a couple of presenters. Just add them, bind them (gin),
recompile, redeploy, et voila. This is exactly what I plan to do with
PuzzleBazar until GWT has better support for manual loading of
external code.

Good luck choosing a framework, let me know if you decide on GWTP.
Reply all
Reply to author
Forward
0 new messages