Not really - even in BlueDragon's implementation with <cfconstructor> you still need to call init() if you want to pass in constructor arguments, just as you do with Java, and therefore I will argue the best practice recommendation is still - in CFMX, in BD and when using Java objects - to chain the init() call onto the createObject() call.

Both in Java and BD, you don't need to call the constructor explicitly if it doesn't have arguments.

The chaining recommendation is not about how init() is implemented per se but about writing code in a style that ensures you can't get uninitialized objects lying around.

Again, in Java and BD, this won't happen because of implicit construction.

The "lack" is not being able to specify initialization arguments in the createObject() call like this:

<cfset obj = createObject("component","foo",arg1,arg2,arg3) />

If that were possible, *that* would be best practice (regardless of whether the underlying mechanism was an init() function or a <cfconstructor> or even a Java object).

I don't like that syntax at all. I rather have a new operator any day.

-Matt

----------------------------------------------------------
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