I also use an init() method.  If I need any instance-based variables, I
create them in this method.  I don't put them in the "unnamed" scope
that exists outside of any method definitions.  I think it's cleaner
that way.

I also create init()s and call them even if the init() doesn't do
anything at this time.

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Schreck, Thomas (PPC)
Sent: Friday, January 16, 2004 8:22 AM
To: [EMAIL PROTECTED]
Subject: RE: [CFCDev] How do you like your initialization?

I typically use an init() method to initialize my object.  Usually I
pass in a record ID and pull the data from a database to populate the
properties of the component using each property's set method.  I also
set variables outside an init() method at the top of the component page.
These variables get set just once when the class is instantiated.  They
are set before any method is called.  I guess this is like a constructor
method in Java.

Thanks -

Tom Schreck
817-252-4900
[EMAIL PROTECTED]

I have not failed.  I've found 10,000 ways that won't work.

- Thomas Edison


-----Original Message-----
From: Bryan F. Hogan [mailto:[EMAIL PROTECTED]
Sent: Friday, January 16, 2004 8:10 AM
To: [EMAIL PROTECTED]
Subject: RE: [CFCDev] How do you like your initialization?

Which way do you prefer to initialize your components? Do you use
getters/setters on the below? Read from a file, etc?

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Christian Cantrell
Sent: Thursday, January 15, 2004 6:25 PM
To: [EMAIL PROTECTED]
Subject: Re: [CFCDev] How do you like your initialization?


On Thursday, January 15, 2004, at 02:14  PM, Bryan F. Hogan wrote:

> What initialization routine do you use? Do you use a properties file?
> Do
> you use getters/setters on the request scope, etc. Do you read a 
> properties file within the CFC? Do you pass or store a location to a 
> properties file?

I use a custom tag that I wrote called <mm:init> which only executes the
code inside it the first time it is encountered:

<mm:init>
     // Initialization code here
</mm:init>

  The INIT tag goes in my Application.cfm file, and typically I try to
just get away with setting application variables.  If I have a lot of
configuration data, I will either put it in a database or an XML file
which is typically retrieved/parsed inside the init tag in the
Application.cfm file.

Christian


----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to
[EMAIL PROTECTED] with the words 'unsubscribe cfcdev' 
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by Mindtool,
Corporation (www.mindtool.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' 
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by Mindtool,
Corporation (www.mindtool.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'
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

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

Reply via email to