Re: [TFUI] The MVP pattern and loose coupling between view/presenter and presenter/model

Ed Howland <[email protected]> Tue, 8 Nov 2005 15:06:06 -0600
Newsgroups gmane.comp.programming.test-first-user-interfaces
Message-ID <[email protected]>
On 9/19/05, Ed Howland <[email protected]> wrote:
> Timothy Wall wrote:
>
> >  At any rate, considering the UI as a parameter collector is one step
> >  that might help form the right patterns in your head.
>
> As I said, that is an intriguing idea. ...
>

After playing around with Ruby a bit, I kinda got into the whole 'less
complicated' code mindset. So my previous thought excursion into
DI/IOC was way overkill. A dialog/form may launch one or more
additional dialogs. Quite probably, those additional dialogs are
conceptually related to the parent dialog/form. If you have a dialog
that can be called from elsewhere, it probably belongs in the
framework or some utility library.

So, I've come around to Tim's viewpoint. I think I would like to amend
the rule from passing only primitive things to passing collections of
primitive things. A Hashtable or Arraylist, while higher order than
strings and ints, is still conceptually in the realm of something we
might like to pass from the view back to the presenter, while
remaining testable. Ruby treats collections as sort of first order
objects. Everything in ruby is an object or a collection of objects.
And objects themselves are sometimes collections of other objects
(strings are collections of chars.)

So if I were writing my form with its dialog in Ruby, (test-first
natch,) I might easily drive the creation of a method in my presenter
that took an array or hash of elements and created a new instance of
the model object and added it to the collection. (In fact, with a
hash, the creation becomes trivial, assuming ctor params or writeable
accessors)

Thanks for all the insights.

Ed


------------------------ Yahoo! Groups Sponsor --------------------~--> 
Most low income households are not online. Help bridge the digital divide today!
http://us.click.yahoo.com/cd_AJB/QnQLAA/TtwFAA/nhFolB/TM
--------------------------------------------------------------------~-> 

To unsubscribe, email:
TestFirstUserInterfaces-unsubscribe-hHKSG33TihhbjbujkaE4pw@public.gmane.org
 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/TestFirstUserInterfaces/

<*> To unsubscribe from this group, send an email to:
    TestFirstUserInterfaces-unsubscribe-hHKSG33TihhbjbujkaE4pw@public.gmane.org

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/