Re: what design pattern to use with DWT

2009-01-30 Thread gregor

Actually, looking (briefly!) at Ian's links, GWT could probably be
best described as ModelDelegate, which is classified as a derivative
of MVC and is what Swing is called it seems.:

http://c2.com/cgi/wiki?ModelDelegate

Also this is a short explanation from Wikipedia of MVC and Swing

GUI frameworks

[edit] Java: Java Swing

Java Swing is different from the other frameworks in that it supports
two MVC patterns:

Model

Frame level model—Like other frameworks, the design of the real
model is usually left to the developer.
Control level model—Swing also supports models on the level of
controls (elements of the graphical user interface). Unlike other
frameworks, Swing exposes the internal storage of each control as a
model.

View
The view is represented by a class that inherits from Component.

Controller
Java Swing doesn't use a single controller. Because its event
model is based on interfaces, it is common to create an anonymous
action class for each event.[citation needed] In fact, the real
controller is in a separate thread, the Event dispatching thread. It
catches and propagates the events to the view and model.

I think this explanation fits very well into GWT's model - we have the
browser's event queue, and we also often use anonymous inner classes
for event listeners.



On Jan 30, 12:03 pm, gregor  wrote:
> I think the guts of MVC was invented (as so much was) at Xerox's Palo
> Alto research center when they invented the first WIMP UIs in the
> 70's. This fed into Smalltalk and was taken up also with Apple Lisa by
> the early 80's. Since most systems at the time were based around text
> screens run from mainframes, they needed a new programming model that
> could handle the idea of the user being able to click on any widget on
> the screen in any order at any time rather than being run through a
> predetermined script, hence MVC.
>
> I'm not sure they had the idea of the Observer pattern at the time,
> and I think Ben is right that the Observer pattern is now an
> alternative/replacement for Controllers in GUI programming. GWT is
> designed to use it. In that sense, I would say maybe the best pattern
> for GWT client coding might be called Model View Observer rather than
> MVC.
>
> On Jan 29, 8:56 pm, Flemming Boller  wrote:
>
> > Now that you mention SmallTalk... I of course agree!
> > when I wrote LISP, I have a funny feeling it about, but I thought it was so
> > :-)
>
> > anyway that for the correction.
> > /Flemming
>
> > On Thu, Jan 29, 2009 at 9:23 PM, Ian Petersen  wrote:
>
> > > On Thu, Jan 29, 2009 at 11:33 AM, Flemming Boller
> > >  wrote:
> > > > MVC goes long back in time. long before web frameworks. I think it came
> > > from
> > > > the language LISP.
>
> > > I don't know how relevant this is, but MVC was first so-named by a
> > > bunch of people designing GUIs in SmallTalk.  I don't remember the
> > > timeframe, but it was definitely before web frameworks became at all
> > > popular.  There's some interesting discussion of the pattern here:
> > >http://c2.com/cgi/wiki?ModelViewController Don't get too lost in that
> > > site--it's easy to burn a lot of time wandering around the Portland
> > > Pattern Repository's wiki.
>
> > > Ian
--~--~-~--~~~---~--~~
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-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: what design pattern to use with DWT

2009-01-30 Thread gregor

I think the guts of MVC was invented (as so much was) at Xerox's Palo
Alto research center when they invented the first WIMP UIs in the
70's. This fed into Smalltalk and was taken up also with Apple Lisa by
the early 80's. Since most systems at the time were based around text
screens run from mainframes, they needed a new programming model that
could handle the idea of the user being able to click on any widget on
the screen in any order at any time rather than being run through a
predetermined script, hence MVC.

I'm not sure they had the idea of the Observer pattern at the time,
and I think Ben is right that the Observer pattern is now an
alternative/replacement for Controllers in GUI programming. GWT is
designed to use it. In that sense, I would say maybe the best pattern
for GWT client coding might be called Model View Observer rather than
MVC.



On Jan 29, 8:56 pm, Flemming Boller  wrote:
> Now that you mention SmallTalk... I of course agree!
> when I wrote LISP, I have a funny feeling it about, but I thought it was so
> :-)
>
> anyway that for the correction.
> /Flemming
>
> On Thu, Jan 29, 2009 at 9:23 PM, Ian Petersen  wrote:
>
> > On Thu, Jan 29, 2009 at 11:33 AM, Flemming Boller
> >  wrote:
> > > MVC goes long back in time. long before web frameworks. I think it came
> > from
> > > the language LISP.
>
> > I don't know how relevant this is, but MVC was first so-named by a
> > bunch of people designing GUIs in SmallTalk.  I don't remember the
> > timeframe, but it was definitely before web frameworks became at all
> > popular.  There's some interesting discussion of the pattern here:
> >http://c2.com/cgi/wiki?ModelViewController Don't get too lost in that
> > site--it's easy to burn a lot of time wandering around the Portland
> > Pattern Repository's wiki.
>
> > Ian
--~--~-~--~~~---~--~~
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-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: what design pattern to use with DWT

2009-01-29 Thread Flemming Boller
Now that you mention SmallTalk... I of course agree!
when I wrote LISP, I have a funny feeling it about, but I thought it was so
:-)

anyway that for the correction.
/Flemming

On Thu, Jan 29, 2009 at 9:23 PM, Ian Petersen  wrote:

>
> On Thu, Jan 29, 2009 at 11:33 AM, Flemming Boller
>  wrote:
> > MVC goes long back in time. long before web frameworks. I think it came
> from
> > the language LISP.
>
> I don't know how relevant this is, but MVC was first so-named by a
> bunch of people designing GUIs in SmallTalk.  I don't remember the
> timeframe, but it was definitely before web frameworks became at all
> popular.  There's some interesting discussion of the pattern here:
> http://c2.com/cgi/wiki?ModelViewController  Don't get too lost in that
> site--it's easy to burn a lot of time wandering around the Portland
> Pattern Repository's wiki.
>
> Ian
>
> >
>

--~--~-~--~~~---~--~~
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-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: what design pattern to use with DWT

2009-01-29 Thread Ian Petersen

On Thu, Jan 29, 2009 at 11:33 AM, Flemming Boller
 wrote:
> MVC goes long back in time. long before web frameworks. I think it came from
> the language LISP.

I don't know how relevant this is, but MVC was first so-named by a
bunch of people designing GUIs in SmallTalk.  I don't remember the
timeframe, but it was definitely before web frameworks became at all
popular.  There's some interesting discussion of the pattern here:
http://c2.com/cgi/wiki?ModelViewController  Don't get too lost in that
site--it's easy to burn a lot of time wandering around the Portland
Pattern Repository's wiki.

Ian

--~--~-~--~~~---~--~~
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-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: what design pattern to use with DWT

2009-01-29 Thread Flemming Boller
Hi

I have successfully used the MVC framework "PureMVC" in GWT. It is
documented rather good, and there are many many examples on their website.
Many of them are written in actionscript, but it is very easy to "translate"
to java.

Regarding "traditional MVC" I think you are a little of road. Traditional
MVC framework are not designed for page-based apps. However the "traditional
web-mvc frameworks" (e.g struts etc) are!, which are not the same thing.

MVC goes long back in time. long before web frameworks. I think it came from
the language LISP.


/Flemming

On Thu, Jan 29, 2009 at 4:36 PM, logicpeters  wrote:

>
> For rich-client apps, such as with Swing and GWT, I would suggest
> something akin to the observer pattern, as Ben mentioned, rather than
> a traditional MVC framework.  MVC frameworks work best with "page-
> based" applications, such as with a form submission and response
> page.  For "component-based" applications (i.e; with menu-items,
> interactive buttons, etc..), there are, unfortunately, few frameworks
> out there to guide you and organize your work.
>
> >
>

--~--~-~--~~~---~--~~
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-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: what design pattern to use with DWT

2009-01-29 Thread logicpeters

For rich-client apps, such as with Swing and GWT, I would suggest
something akin to the observer pattern, as Ben mentioned, rather than
a traditional MVC framework.  MVC frameworks work best with "page-
based" applications, such as with a form submission and response
page.  For "component-based" applications (i.e; with menu-items,
interactive buttons, etc..), there are, unfortunately, few frameworks
out there to guide you and organize your work.

--~--~-~--~~~---~--~~
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-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: what design pattern to use with DWT

2009-01-28 Thread babar nazir
Hi dears,

i need the .pdf tutorial of GWT because i want to present it to my fellows,
please any one have it, mail it to me

Regards:

Best Regards:

Muhammad Babar Nazir
Software Engineer
SENSYS pvt. Ltd.
79-B Tech Society, Lahore.
babar.na...@sensys.com
Cell# +92-346-7464803

--~--~-~--~~~---~--~~
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-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: what design pattern to use with DWT

2009-01-28 Thread asdf_asdf

Thanks you all for replies.

I am slowly realising the paradigm shift in that mostly everything is
executed on the client.
Nevertheless I would still tend to think that the MVC is applicable in
that case. For instance, there could be at least 2 ways to respond to
client's clicking on a menu item:
a) a completely new page (with possibly its own gwt generated js) is
served
b) something happens in within this page.

when you take a look at situation b), then I would want to see some
type of mvc implementation in the applicable .js file. Examples show
that in such a case an event listener should be attached to a menu
item that could theoretically render an imaginary table in the middle
of the page. I wonder if event-based development the only, or possibly
recommended way to program behavior? While as I am writing it, I am
slowly being convinced that it is :) Though I am still concerned that
through attaching events to components the code could easily become
unmanageable.

Another preemptive question. If I want my dwr project to have multiple
html pages with generated js. Does in that case each html page
corresponds to a different module and linked to a separate class that
implements EntryPoint interface.

Thank you lots.



On Jan 28, 5:33 pm, Ian Petersen  wrote:
> On Wed, Jan 28, 2009 at 8:10 AM, asdf_asdf  wrote:
> > I am new to GWT and evaluate it currently. Just happily went through
> > the official tutorial and full of questions taunting my mind.
> > Just a quick background (should my question seem a bit messy): I am
> > coming from php field and have in past have been using a mvc framework
> > (CodeIgniter) where links/forms on a single webpage are mapped to
> > methods of a controller responsible for calling buisiness logic and
> > putting together view components. So...
>
> > * Is MVC the recommended design pattern to develop GWT applications? I
> > see then the class implementing EntryPoint interface as being a
> > "controller", but what would be a view in that case? I am struggling
> > to understand the relationship between html-page and the controller
> > that gets called: does each controller get called by the html-page
> > that loads the appropriate javascript file and how could a controller
> > have methods mapped to specific a user actions. For instance, after a
> > specific link is clicked a new widget is shown (in the tutorial this
> > is achieved through listeners, but can there be a url to method
> > mapping as well)?
>
> > * In respect to tutorial, what does the attribute path="/stockPrices"
> > in  xml tag mean and the identical annotation
> > @RemoteServiceRelativePath("stockPrices") in service interface? I
> > assume that the server-side method gets called when under that url,
> > but how is the client aware of the mapping?
>
> > * So far I have only seen tutorials on implementing relatively easy
> > projects. Does anyone know if there a more powerful sample application
> > with open source available: something where there is a need for more
> > than one html-page and controller exist?
>
> It seems you're missing a pretty fundamental difference between GWT
> apps and apps built with almost any other major web platform: with GWT
> it's all client side.
>
> Now, nothing's ever as simple as that, but it's a good first
> approximation in this case.  With server-side frameworks like anything
> that depends on PHP, Ruby, Python, Perl, or Java (besides GWT),
> there's comparitively little in the way of smarts on the client side.
> With GWT, you can build an entire app that has absolutely zero smarts
> on the server side.
>
> If you want to build a client app in GWT that interacts with a RESTful
> server, you can definitely map client-side events to URLs, but that's
> not the only way to do things with GWT.  You can put all your business
> logic on the client, you can access server-side business logic with
> GWT-RPC or other RPC-over-HTTP mechanisms, or you can strike a balance
> and split the business logic across both client and server.  One
> advantage of GWT is that, with GWT-RPC and a Java-language
> server-side, you can encode business logic in a set of Java classes
> and run the same code on both the client and the server (with the
> caveat that you have to limit yourself to those parts of the JRE that
> GWT supports).
>
> As far as examples go, you probably want to look at the other example
> apps in the GWT documentation.  If I remember right, the mail app is
> pretty comprehensive, and the doc for GWT-RPC is pretty good, too.
> There's also a frequent poster on this list with an entire site
> dedicated to GWT example code.  I can't remember his name right now,
> but his website is "roughian", or something like that.  His name might
> also be Ian, as a matter of fact.  Anyway, search the list's history
> for examples and I'm sure you'll find it.
>
> Ian
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Goo

Re: what design pattern to use with DWT

2009-01-28 Thread Ben Tilford
The "controller" in GWT should for most cases use the observer pattern, your
model should support property change events and registering listeners. This
gets around the action way of implementing a controller and is quite a bit
more flexible since you could have multiple listeners for a single event. If
your not already familiar with listeners you may want to look at some Swing
applications since GWT and Swing both use the same Property Change Support
mechanisms. Also "GWT In Practice" has some pretty good examples of how GWT
is intended to be used in terms of an MVC approach if your interested in a
book on the subject.

On Wed, Jan 28, 2009 at 1:17 PM, gregor wrote:

>
> I would not get too hung up on the "Controller" part of MVC. I don't
> know php, but it sounds the same as struts: cycles of pages (views)
> rendered to client driven by action classes (controllers) that both
> use a model (beans in Java speak). These action classes that drive
> generation of the next view fit beautifully into MVC pattern as
> controllers, but in a GWT application there is no need of them because
> this work can be done on either the client or the server as
> appropriate for the use case, and in general the more on the client
> the better (keep as much state as possible on client). Therefore
> exactly what a "controller" is in a GWT application is IMO a slippery
> concept.
>
> I would recommend two things:
>
> 1) If you are starting a new project download 1.6 from trunk to take
> advantage of the new Event model. It is much more powerful than the
> existing <=1.5 event system. Unfortunately there is is little
> documentation for it yet (even the javadoc is sparse) but I'm sure
> questions about it would be answered here PDQ. Experimenting with this
> will help you determine how you might best design your client GUI,
> i.e. how your main components might best communicate between
> themselves and when necessary with the server.
>
> 2)  In an ideal (MVC) world what Ian calls "smarts" should live in
> domain model classes, and these should flow freely across networks. As
> Ian points out this is sometimes possible and sometimes (perhaps most
> often) it isn't because we are dealing with a given technology stack
> that we can't alter in the short term. I don't think there is any one
> satisfactory answer to this question - every application has it's own
> use cases that will rub up against technology stack limitations in
> different ways. My point is that thinking about this (i.e. how to
> implement a domain model in a real world stack) is much more important
> than worrying about what a "controller" is.
>
> regards
> gregor
>
> On Jan 28, 4:35 pm, Jason Essington  wrote:
> > MVC is a good design pattern to use with GWT.
> > If you are new to GWT, get Ryan Dewsbury's book "Google Web Toolkit
> > Applications" it does a very good job of outlining exactly what is
> > model, view and controller in each example project.
> >
> > -jason
> >
> > On Jan 28, 2009, at 9:10 AM, asdf_asdf wrote:
> >
> >
> >
> > > His,
> >
> > > I am new to GWT and evaluate it currently. Just happily went through
> > > the official tutorial and full of questions taunting my mind.
> > > Just a quick background (should my question seem a bit messy): I am
> > > coming from php field and have in past have been using a mvc framework
> > > (CodeIgniter) where links/forms on a single webpage are mapped to
> > > methods of a controller responsible for calling buisiness logic and
> > > putting together view components. So...
> >
> > > * Is MVC the recommended design pattern to develop GWT applications? I
> > > see then the class implementing EntryPoint interface as being a
> > > "controller", but what would be a view in that case? I am struggling
> > > to understand the relationship between html-page and the controller
> > > that gets called: does each controller get called by the html-page
> > > that loads the appropriate javascript file and how could a controller
> > > have methods mapped to specific a user actions. For instance, after a
> > > specific link is clicked a new widget is shown (in the tutorial this
> > > is achieved through listeners, but can there be a url to method
> > > mapping as well)?
> >
> > > * In respect to tutorial, what does the attribute path="/stockPrices"
> > > in  xml tag mean and the identical annotation
> > > @RemoteServiceRelativePath("stockPrices") in service interface? I
> > > assume that the server-side method gets called when under that url,
> > > but how is the client aware of the mapping?
> >
> > > * So far I have only seen tutorials on implementing relatively easy
> > > projects. Does anyone know if there a more powerful sample application
> > > with open source available: something where there is a need for more
> > > than one html-page and controller exist?
> >
> > > Many thanks,
> > > Denis
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups

Re: what design pattern to use with DWT

2009-01-28 Thread gregor

I would not get too hung up on the "Controller" part of MVC. I don't
know php, but it sounds the same as struts: cycles of pages (views)
rendered to client driven by action classes (controllers) that both
use a model (beans in Java speak). These action classes that drive
generation of the next view fit beautifully into MVC pattern as
controllers, but in a GWT application there is no need of them because
this work can be done on either the client or the server as
appropriate for the use case, and in general the more on the client
the better (keep as much state as possible on client). Therefore
exactly what a "controller" is in a GWT application is IMO a slippery
concept.

I would recommend two things:

1) If you are starting a new project download 1.6 from trunk to take
advantage of the new Event model. It is much more powerful than the
existing <=1.5 event system. Unfortunately there is is little
documentation for it yet (even the javadoc is sparse) but I'm sure
questions about it would be answered here PDQ. Experimenting with this
will help you determine how you might best design your client GUI,
i.e. how your main components might best communicate between
themselves and when necessary with the server.

2)  In an ideal (MVC) world what Ian calls "smarts" should live in
domain model classes, and these should flow freely across networks. As
Ian points out this is sometimes possible and sometimes (perhaps most
often) it isn't because we are dealing with a given technology stack
that we can't alter in the short term. I don't think there is any one
satisfactory answer to this question - every application has it's own
use cases that will rub up against technology stack limitations in
different ways. My point is that thinking about this (i.e. how to
implement a domain model in a real world stack) is much more important
than worrying about what a "controller" is.

regards
gregor

On Jan 28, 4:35 pm, Jason Essington  wrote:
> MVC is a good design pattern to use with GWT.
> If you are new to GWT, get Ryan Dewsbury's book "Google Web Toolkit  
> Applications" it does a very good job of outlining exactly what is  
> model, view and controller in each example project.
>
> -jason
>
> On Jan 28, 2009, at 9:10 AM, asdf_asdf wrote:
>
>
>
> > His,
>
> > I am new to GWT and evaluate it currently. Just happily went through
> > the official tutorial and full of questions taunting my mind.
> > Just a quick background (should my question seem a bit messy): I am
> > coming from php field and have in past have been using a mvc framework
> > (CodeIgniter) where links/forms on a single webpage are mapped to
> > methods of a controller responsible for calling buisiness logic and
> > putting together view components. So...
>
> > * Is MVC the recommended design pattern to develop GWT applications? I
> > see then the class implementing EntryPoint interface as being a
> > "controller", but what would be a view in that case? I am struggling
> > to understand the relationship between html-page and the controller
> > that gets called: does each controller get called by the html-page
> > that loads the appropriate javascript file and how could a controller
> > have methods mapped to specific a user actions. For instance, after a
> > specific link is clicked a new widget is shown (in the tutorial this
> > is achieved through listeners, but can there be a url to method
> > mapping as well)?
>
> > * In respect to tutorial, what does the attribute path="/stockPrices"
> > in  xml tag mean and the identical annotation
> > @RemoteServiceRelativePath("stockPrices") in service interface? I
> > assume that the server-side method gets called when under that url,
> > but how is the client aware of the mapping?
>
> > * So far I have only seen tutorials on implementing relatively easy
> > projects. Does anyone know if there a more powerful sample application
> > with open source available: something where there is a need for more
> > than one html-page and controller exist?
>
> > Many thanks,
> > Denis
--~--~-~--~~~---~--~~
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-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: what design pattern to use with DWT

2009-01-28 Thread Jason Essington

MVC is a good design pattern to use with GWT.
If you are new to GWT, get Ryan Dewsbury's book "Google Web Toolkit  
Applications" it does a very good job of outlining exactly what is  
model, view and controller in each example project.

-jason

On Jan 28, 2009, at 9:10 AM, asdf_asdf wrote:

>
> His,
>
> I am new to GWT and evaluate it currently. Just happily went through
> the official tutorial and full of questions taunting my mind.
> Just a quick background (should my question seem a bit messy): I am
> coming from php field and have in past have been using a mvc framework
> (CodeIgniter) where links/forms on a single webpage are mapped to
> methods of a controller responsible for calling buisiness logic and
> putting together view components. So...
>
> * Is MVC the recommended design pattern to develop GWT applications? I
> see then the class implementing EntryPoint interface as being a
> "controller", but what would be a view in that case? I am struggling
> to understand the relationship between html-page and the controller
> that gets called: does each controller get called by the html-page
> that loads the appropriate javascript file and how could a controller
> have methods mapped to specific a user actions. For instance, after a
> specific link is clicked a new widget is shown (in the tutorial this
> is achieved through listeners, but can there be a url to method
> mapping as well)?
>
> * In respect to tutorial, what does the attribute path="/stockPrices"
> in  xml tag mean and the identical annotation
> @RemoteServiceRelativePath("stockPrices") in service interface? I
> assume that the server-side method gets called when under that url,
> but how is the client aware of the mapping?
>
> * So far I have only seen tutorials on implementing relatively easy
> projects. Does anyone know if there a more powerful sample application
> with open source available: something where there is a need for more
> than one html-page and controller exist?
>
> Many thanks,
> Denis
>
> >


--~--~-~--~~~---~--~~
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-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: what design pattern to use with DWT

2009-01-28 Thread Ian Petersen

On Wed, Jan 28, 2009 at 8:10 AM, asdf_asdf  wrote:
> I am new to GWT and evaluate it currently. Just happily went through
> the official tutorial and full of questions taunting my mind.
> Just a quick background (should my question seem a bit messy): I am
> coming from php field and have in past have been using a mvc framework
> (CodeIgniter) where links/forms on a single webpage are mapped to
> methods of a controller responsible for calling buisiness logic and
> putting together view components. So...
>
> * Is MVC the recommended design pattern to develop GWT applications? I
> see then the class implementing EntryPoint interface as being a
> "controller", but what would be a view in that case? I am struggling
> to understand the relationship between html-page and the controller
> that gets called: does each controller get called by the html-page
> that loads the appropriate javascript file and how could a controller
> have methods mapped to specific a user actions. For instance, after a
> specific link is clicked a new widget is shown (in the tutorial this
> is achieved through listeners, but can there be a url to method
> mapping as well)?
>
> * In respect to tutorial, what does the attribute path="/stockPrices"
> in  xml tag mean and the identical annotation
> @RemoteServiceRelativePath("stockPrices") in service interface? I
> assume that the server-side method gets called when under that url,
> but how is the client aware of the mapping?
>
> * So far I have only seen tutorials on implementing relatively easy
> projects. Does anyone know if there a more powerful sample application
> with open source available: something where there is a need for more
> than one html-page and controller exist?

It seems you're missing a pretty fundamental difference between GWT
apps and apps built with almost any other major web platform: with GWT
it's all client side.

Now, nothing's ever as simple as that, but it's a good first
approximation in this case.  With server-side frameworks like anything
that depends on PHP, Ruby, Python, Perl, or Java (besides GWT),
there's comparitively little in the way of smarts on the client side.
With GWT, you can build an entire app that has absolutely zero smarts
on the server side.

If you want to build a client app in GWT that interacts with a RESTful
server, you can definitely map client-side events to URLs, but that's
not the only way to do things with GWT.  You can put all your business
logic on the client, you can access server-side business logic with
GWT-RPC or other RPC-over-HTTP mechanisms, or you can strike a balance
and split the business logic across both client and server.  One
advantage of GWT is that, with GWT-RPC and a Java-language
server-side, you can encode business logic in a set of Java classes
and run the same code on both the client and the server (with the
caveat that you have to limit yourself to those parts of the JRE that
GWT supports).

As far as examples go, you probably want to look at the other example
apps in the GWT documentation.  If I remember right, the mail app is
pretty comprehensive, and the doc for GWT-RPC is pretty good, too.
There's also a frequent poster on this list with an entire site
dedicated to GWT example code.  I can't remember his name right now,
but his website is "roughian", or something like that.  His name might
also be Ian, as a matter of fact.  Anyway, search the list's history
for examples and I'm sure you'll find it.

Ian

--~--~-~--~~~---~--~~
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-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---