Great discussion gents.  I've learned something new today. :)  My
modus operandi is option a, but now that I look at it, the Law of
Demeter is something to seriously consider.  On the other hand, most
API docs that I've browsed though provide a road map through the
composition hierarchy, so in the end, I think option b is more of a
courtesy than a commandment.  Just my 2 cents.

Paul

On Nov 7, 2007 6:59 PM, Sam Larbi <[EMAIL PROTECTED]> wrote:
>
>
>
> On Nov 7, 2007 5:15 PM, Sam Larbi <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> >
> > >
> > >
> > > 1) When I want to get and set properties of the Address bean from
> > > client code should I
> > > a) use objUser.getAddress().setCity("Dundee") or
> > > b) should I have setters in the User object that delegates to the
> > > Address object ie objUser.setCity("Dundee") and in User.cfc have the
> > > method setCity() doing variables.objAddress.setCity()
> > >
> >
> >
> >
> > Let the Law of Demeter be your guide:
> > http://en.wikipedia.org/wiki/Law_of_Demeter
> >
> > It says you should go for option b, if I understand it correctly.
> However, I seem to have a slight preference for option A at times, and I
> can't recall when it has brought me trouble.
>
>
> Thinking about this some more I've noticed a bit different trend than a
> "slight preference for option A."  I think I slightly prefer A when I'm
> using someone else's code - some published API or framework where I can be
> sure they are taking great pains to make a decision and stick with it.  I
> don't mind calling Model.Bones["bone_name"].Position.X when the framework
> gives it to me that way, but I can't think of a time when I've written code
> like that.
>
> I'm sure it's happened, but nothing is standing out.  In my own code, at
> least lately, I think I normally try to follow Law of Demeter.
>
> I'll certainly pay more attention for a while.
>
>
>
> Sam
>  >
>



-- 
Paul Marcotte
Fancy Bread - in the heart or in the head?
http://www.fancybread.com

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CFCDev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cfcdev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to