I would write the following block of code  (from the whole thing)
��� <cfcase value="dangerous">
        <cfif arguments.animal.getFoodType() is "meat">
             <cfset lockAnimal(arguments.animal) />
             <cfset arguments.animal.eat("meat pellets") />
             <cfset unlockAnimal(arguments.animal) />
        <cfelseif arguments.animal.getFoodType() is "veggie">
             <cfset lockAnimal(arguments.animal) />
             <cfset arguments.animal.eat("veggie pellets") />
             <cfset unlockAnimal(arguments.animal) />
        </cfif>
    </cfcase>

as
�� <cfcase value="dangerous">��
�� ��� <cfset lockAnimal(arguments.animal) />
� ��� ��� <cfif arguments.animal.getFoodType() is "meat">
 ��� ��� ��� <cfset arguments.animal.eat("meat pellets") />
��������� <cfelseif arguments.animal.getFoodType() is "veggie">
 ��� ��� ��� <cfset arguments.animal.eat("veggie pellets") />
� ��� ��� </cfif>��
�� ��� <cfset unlockAnimal(arguments.animal) />
�� </cfcase>


Sounds reasonable. But from this sample I don't know whether lockAnimal() and unlockAnimal() and getFoodType() might cause some sort of deadlock. If I knew it couldn't, I might code it your way. If it could potentailly, or if I didn't know, or if I didn't control those functions, I might code it as:

���<cfcase value="dangerous">
� ��� �<cfset FoodPellets = "undefined pellets" />
�� ��� <cfif arguments.animal.getFoodType() is "meat">
� ��� ��� <cfset FoodPellets = "meat pellets" />
������ <cfelseif arguments.animal.getFoodType() is "veggie">
� ��� ��� <cfset FoodPellets = "veggie pellets" />
�� ��� </cfif>
�� ��� <cfset lockAnimal(arguments.animal) />
� ��� ��� <cfset arguments.animal.eat(FoodPellets) />
�� ��� <cfset unlockAnimal(arguments.animal) />
�� </cfcase>

...or, if the choice is only meat or veggie:

���<cfcase value="dangerous">
�� ��� <cfif arguments.animal.getFoodType() is "meat">
� ��� ��� <cfset FoodPellets = "meat pellets" />
������ <cfelse arguments.animal.getFoodType() is "veggie">
� ��� ��� <cfset FoodPellets = "veggie pellets" />
�� ��� </cfif>
�� ��� <cfset lockAnimal(arguments.animal) />
� ��� ��� <cfset arguments.animal.eat(FoodPellets) />
�� ��� <cfset unlockAnimal(arguments.animal) />
�� </cfcase>




--

        Ben Curtis
        WebSciences International
        http://www.websciences.org/
        v: (310) 478-6648
        f: (310) 235-2067




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