|
As far as i understand, the init() method's job is to get an object in
a state where it's ready to use. If other methods in the object require
access to a variable, like a DSN for instance, or an object, the init()
should provide for that. In Java, the init() function is called automatically when an instance is of an object is created. In CF, it is not - it's just a convention. It's up to the developer to remember to call it. The purpose of the convention is to give us a common method to use to initialize an object, so we understand our own and each other's code more easily. The purpose of chaining the init() call by convention is to group object instantiation with it's initialization, like Java does automatically. Today, your utility cfc doesn't need initialization. If you're not using a factory, you might have many places in your code with createObject calls like <cfset var SortMaster = CreateObject("Component",
"CAMSymphony.model.util.SortMaster") />
"Tomorrow", you might decide to change SortMaster in a way that
requires initialization. Assuming your app is live, you might have a
delicate dance deploying the change without breaking your app. And
you'll need to touch much more code than you would if you already had
the init() in place.Now in this particular case, it might not be a big deal. But the larger the app, the more these considerations come into play. Joshua Scott wrote: All, |
- [CFCDev] Init Methods on CFCs Joshua Scott
- RE: [CFCDev] Init Methods on CFCs Ben Nadel
- RE: [CFCDev] Init Methods on CF... Gurevich, Gerry \(NIH/NIEHS\) [C]
- RE: [CFCDev] Init Methods on CF... Phillip Senn
- Re: [CFCDev] Init Methods o... Daniel Roberts
- RE: ** RE: [CFCDev] Init Me... Joshua Scott
- Re: [CFCDev] Init Methods on CFCs Aaron Rouse
- Re: [CFCDev] Init Methods on CFCs Nando
- Re: [CFCDev] Init Methods on CF... Brian Kotek
- Re: [CFCDev] Init Methods on CF... Aaron Rouse
- Re: [CFCDev] Init Methods on CFCs David Ross
- Re: [CFCDev] Init Methods on CF... Aaron Rouse
- RE: [CFCDev] Init Methods on CF... Joshua Scott

