Here's what the createGateway() function might look like.
<cffunction name="createGateway">
<cfargument name="name">
<cfreturn createObject("component",
"#arguments.name#Gateway").init(variables.dsn)/>
</cffunction>
I'm assuming the factory itself knows what dsn to use.
Patrick
On 11/3/05, Baz <[EMAIL PROTECTED]> wrote:
>
>
> How would the gateway get the SN itself?
>
> Baz
>
>
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
> Of Patrick McElhaney
> Sent: Thursday, November 03, 2005 9:55 AM
> To: [email protected]
> Subject: Re: [CFCDev] Factory Pattern
>
> Oops. I didn't mean to pass the dsn to createGateway().
> CreateGateway() would know how to find the dsn itself.
>
> > You can make the same code reduction by having a single method per object.
> >
> > <cffunction name="createSecurityService">
> > <cfreturn createObject("component", "security").init()/>
> > </cffunction>
> >
> > <cffunction name="createFooGateway">
> > <cfreturn createGateway("foo")/>
> > </cffunction>
> >
> > <cffunction name="createBarGateway">
> > <cfreturn createGateway("bar")/>
> > </cffunction>
> >
>
>
>
> --
> 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).
>
> An archive of the CFCDev list is available at
> www.mail-archive.com/[email protected]
>
>
>
>
>
> ----------------------------------------------------------
> 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).
>
> An archive of the CFCDev list is available at
> www.mail-archive.com/[email protected]
>
>
>
--
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).
An archive of the CFCDev list is available at
www.mail-archive.com/[email protected]