On 10/26/05, Hal Helms <[EMAIL PROTECTED]> wrote:
> I agree, Patrick, that your idea is a fine one where possible. But are you
> really suggesting that for every method that a Person object has, an
> additional method exist to get their spouse to do it also?

No, not at all. I only create the fooSpouse() method when the need
arises. If I have a method that calls person.getSpouse.foo(), I might
create a person.fooSpouse() method. But I'm not going to automatically
create a person.barSpouse() method. Such a method may never be used!

> So, yes, you really do many times have to have things like
> hal.getSpouse().getCompany().getStockPrice().

I hope I won't have to do that type of thing very often. Not only do
we have to make sure Hal has a spouse. We need to make sure that Hal's
wife is employed. And what if she's employed by more than one company?
What if her company is privately held?

If a client gives me a use case like, "Display the person's spouse's
company's stock price" I would probably end up creating a method like
person.getSpouseCompanyStockPrice().

In the end I might actually have a private variable called
spouseCompanyStockPrice. Once I weed out all of the details that
aren't relevant to this application, that may be all I need.

Patrick

--
Patrick McElhaney
704.560.9117
http://pmcelhaney.weblogs.us


----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to 
[email protected] with the words 'unsubscribe cfcdev' as the subject of the 
email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting 
(www.cfxhosting.com).

CFCDev is supported by New Atlanta, makers of BlueDragon
http://www.newatlanta.com/products/bluedragon/index.cfm

An archive of the CFCDev list is available at 
www.mail-archive.com/[email protected]


Reply via email to