I am still at the most basic level, so I 'll stick to MVC for this moment.

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Paul Andrews
Sent: maandag 5 maart 2012 17:01
To: Flash Coders List
Subject: Re: [Flashcoders] MVC style Correction

I'm guessing we're now into nuancing the model to hold view states and the
presenter is controlling multiple views, or is that wrong?

On 05/03/2012 15:33, Peter Ginneberge wrote:
>> The dependency with this is that any changes to the UI - additional 
>> views being added or removed, requires that the controller be changed 
>> too. Any change to a view could cause the controller to become broken.
>>
>> For this reason, I would say it's bad practice.
>
> Not necessarily so.
> But.. you'd use an interface, which the view implements.
> In which case you'd probably be talking about a Presenter rather than 
> a Controller :)
>
> pseudo code:
>
> // PRESENTER
> private var view:IView;
> public function ViewPresenter(v:IView) {
>    view = v;
>    // add listeners and whatnot..
> }
>
> onSomeEventHandler(event:SomeEvent):void {
>    view.update();
> }
>
> ================================
>
> // VIEW
> public class MyView implements IView {
>    public function update()(// do stuff); }
>
> ================================
>
> // VIEW INTERFACE
> public interface IView {
>    public function update();
> }
>
> GWT uses this kind of architecture:
> http://code.google.com/intl/nl/webtoolkit/articles/mvp-architecture.ht
> ml 
> http://code.google.com/intl/nl/webtoolkit/articles/mvp-architecture.ht
> ml#binding
>
>
> http://code.google.com/intl/nl/webtoolkit/articles/mvp-architecture-2.
> html
>
>
> http://www.google.com/intl/nl/events/io/2009/sessions/GoogleWebToolkit
> BestPractices.html
>
>
> So in GWT I usually have:
>
> (only 1) AppController
> (several) Presenter + View + Model triads
>
> A view dispatches events to which the presenter listens.
> Presenter talks to view via its interface.
>
> View doesn't know the presenter, Presenter doesn't know the view, only 
> its interface.
>
> regards,
> Muzak
>
> ----- Original Message ----- From: "Paul Andrews" <[email protected]>
> To: <[email protected]>
> Sent: Monday, March 05, 2012 3:11 PM
> Subject: Re: [Flashcoders] MVC style Correction
>
>
>> The dependency with this is that any changes to the UI - additional 
>> views being added or removed, requires that the controller be changed 
>> too. Any change to a view could cause the controller to become broken.
>>
>> For this reason, I would say it's bad practice.
>>
>>
>> On 05/03/2012 13:57, Merrill, Jason wrote:
>>>>> tutor mentions Controller can update View, but that example is not 
>>>>> included.
>>>>> If anyone can give me a little example of how that is done in MVC, 
>>>>> don't hasitate
>>> In about the simplest form:
>>>
>>>
>>> //In the controller:
>>>
>>> onSomeEventHandler(event:SomeEvent):void
>>> {
>>> _someViewInstance.update();
>>> }
>>>
>>>
>>> //In the view:
>>>
>>> public function update():void
>>> {
>>> //Do stuff to change the view
>>> }
>>>
>>> Hope that helps.
>>>
>>>
>>>   Jason Merrill
>
> _______________________________________________
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>

_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to