I am going to agree with Sean. CreateObject is not a constructor, but the equivalent to the new operator in java. The only difference is the underlying technology, in java's case it expects to have a constructor to call to setup the object that is named as so by the class in question.
Coldfusion has this too, except we are forced to name ours and best practice that was easily adopted was the init() method. CreateObject strangely enough creates the object but doesn't care what or how you do what comes next. And to throw that sort of argument as Sean pointed out is not relevant to Coldfusion in any shape or form. But to throw a spanner in the works, I have always wondered why Coldfusion doesn't use / force to have constructors. I would certainly have liked to have pushed for it as a nice new little feature, that way the CreateObject could be considered the same as the new operator in java. Wishful thinking maybe, I know. Andrew Scott Senior Coldfusion Developer Aegeon Pty. Ltd. www.aegeon.com.au Phone: +613 8676 4223 Mobile: 0404 998 273 -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Sean Corfield Sent: Thursday, 5 July 2007 3:15 PM To: [email protected] Subject: Re: [CFCDEV] More on class objects aka single class Service objects On 7/4/07, Jaime Metcher <[EMAIL PROTECTED]> wrote: > One could argue that in CF there is only one constructor, and it's > CreateObject(). It's always accessible, and as the developer of a CFC I can > do nothing to turn it off, influence its behaviour, or rely on any > initialization being run other than the no-argument non-method > "pseudo-constructor". Surely that was Gilad's other main point? No. And your supposition is not actually true anyway. Your pseudo-constructor can throw an exception if certain conditions are met, thus preventing use of createObject(). You can use the metadata of the object as "static" data and implement full fledged singletons, for example. The problem is that you're taking an argument that is essentially leveled against Java and applying it against ColdFusion. Your logic is flawed. I also think you're over-analyzing an academic issue that has no basis in reality - which is essentially what happens in Gilad's thread... the "who cares?" responses. Can you state a *specific* problem that you think needs to be solved rather than appealing to abstract -- Sean A Corfield -- (904) 302-SEAN An Architect's View -- http://corfield.org/ "If you're not annoying somebody, you're not really alive." -- Margaret Atwood You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/[email protected] No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.476 / Virus Database: 269.9.14/885 - Release Date: 3/07/2007 10:02 AM No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.476 / Virus Database: 269.9.14/885 - Release Date: 3/07/2007 10:02 AM You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/[email protected]
