|
Rather
than let the cfc know about the two different ways it can get data, just let it
concentrate only on one. The cfc should only accept firstName and
lastName. In your code that calls the cfc, use a cfif to determine which
set of variables will populate the cfc.
One
mindset that is preached here, and for good reason, is don't make the cfcs aware
of their surroundings or assume to know about other variable scopes.
Treat them as introverted black boxes that accept only what you give
them.
pseudo-code:
cfif
IsDefined(form)
objcfc.init(form.firstName, form.lastName)
cfelse
IsDefined(struct)
objcfc.init(customer.firstName, customer.lastName)
/cfif
|
Title: Message
- [CFCDev] Code Reuse Paul Giesenhagen
- Re: [CFCDev] Code Reuse Marcantonio Silva
- Re: [CFCDev] Code Reuse Paul Giesenhagen
- Re: [CFCDev] Code Reuse Marcantonio Silva
- RE: [CFCDev] Code Reuse Jeff Britts
- Re: [CFCDev] Code Reuse Dawson, Michael
- Re: [CFCDev] Code Reuse Paul Giesenhagen
- RE: [CFCDev] Code Reuse Dawson, Michael
