I also assume the user of the object has called Init.  Almost every
component I write requires some sort of Init to be done in order for the
component to function properly.

I started off using some utility functions to check initialization
(_AssertInitialized(), _AssertNotInitialized()) that would throw
exceptions if the initialization state wasn't what I expected, but the
maintenance of these functions became much more time consuming than
tracking down bugs caused by a developer not calling Init(). 

I would like to see required constructors handled at the language level
in some future CF release.

Jon

>>> [EMAIL PROTECTED] 03/16/04 08:45AM >>>
Whether good or bad, I *assume* init has been called and don't perform
explicit checks.

 

  _____  

From: Raymond Camden [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, March 16, 2004 10:38 AM
To: [EMAIL PROTECTED] 
Subject: RE: [CFCDev] RFC, CFC Best Practices

 

Speaking of init - how do folks handle cases where they want to force
an
init w/ arguments? For example, maybe the CFC needs a datasource name
in
order to work correctly. I don't want to add checks to all my methods
to
make sure Init() was called. I _could_ use defaults but that wont
apply
in all cases.

 

=======================================================================
Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc
Member of Team Macromedia

Email    : [EMAIL PROTECTED] 
Blog     : www.camdenfamily.com/morpheus/blog 
Yahoo IM : morpheus

"My ally is the Force, and a powerful ally it is." - Yoda 

 

         

        
  _____  


        From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]

On Behalf Of Dawson, Michael
        Sent: Tuesday, March 16, 2004 9:24 AM
        To: [EMAIL PROTECTED] 
        Subject: RE: [CFCDev] RFC, CFC Best Practices

        I would rather use a specific Init() method rather than rely on
a behavior of the CFC.  I previously used the psuedo-constructor area,
but with an uneasy feeling that MACR may change it and, in turn, break
my code.

         

        By specifying Init(), MACR is less-likely to break my code w/o
affecting all other users as well.

         

        A compromise would be to coding an Init() method, but also
invoking that method in the psuedo-constructor area...



<table width=800 cellpadding=4 cellspacing=10 border=0><tr
bgcolor=BDBDBD><td valign=top width=400><font face=verdana size=2
color=FFFFFF><b>AVIS IMPORTANT</b></font></td><td valign=top
width=400><font face=verdana size=2
color=FFFFFF><b>WARNING</b></font></td></tr><tr><td valign=top
width=400><p align=justify><font face=verdana size=1 color=808080> Les
informations contenues dans le present document et ses pieces jointes
sont strictement confidentielles et reservees a l'usage de la (des)
personne(s) a qui il est adresse. Si vous n'etes pas le destinataire,
soyez avise que toute divulgation, distribution, copie, ou autre
utilisation de ces informations est strictement prohibee. Si vous avez
recu ce document par erreur, veuillez s'il vous plait communiquer
immediatement avec l'expediteur et detruire ce document sans en faire de
copie sous quelque forme.</td><td valign=top width=400><p
align=justify><font face=verdana size=1 color=808080> The information
contained in this document and attachments is confidential and intended
only for the person(s) named above. If you are not the intended
recipient you are hereby notified that any disclosure, copying,
distribution, or any other use of the information is strictly
prohibited. If you have received this document by mistake, please notify
the sender immediately and destroy this document and attachments without
making any copy of any kind.</td></tr></table>

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