regardless of whether or not CF is duck typed or dynamic, the dynamic
languages I've used   have all had this ability.  Say you have an cfc
that expects a vehicle, you send it a bike and you send it a car, both
are vehicles, but both behave differently in some aspects.  They may
both have a 'go', but only the car will have 'checkFuelLevel'.  Which
would be the bigger performance hit, using a try catch block or just
checking the type or class of an object?



On 6/6/07, Jake Pilgrim <[EMAIL PROTECTED]> wrote:
> You don't want to do that in Coldfusion - it is unnecessary and is actually a 
> performance hit as well. Read up on 'duck typing' - Sean Corfield has a nice 
> powerpoint that outlines this concept. You have to remember that Coldfusion 
> does not enforce strict typing; Coldfusion is not Java!! The basic idea is 
> that if you pass in a value (be it a string, query, object, whatever) and it 
> works within your code, it is of the correct type (if it walks like a duck, 
> quacks like a duck, it's a duck!). If you pass in a numeric value to a 
> function that is expecting a string, it's going to work. If you pass in an 
> object with properties x, y, and z to a function expecting an object with 
> properties x, y, and z it's going to work. If you were to restrict your 
> function to only accept objects with a type of cfc.exampleObj, you are 
> unnecessarily restricting the possible input of your function as well as 
> creating a performance loss by making your function check the object's type 
> in the first place!
>
> As defined by Wikipedia - http://en.wikipedia.org/wiki/Duck_typing
>
> Jake Pilgrim
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
ColdFusion MX7 and Flex 2 
Build sales & marketing dashboard RIA’s for your business. Upgrade now
http://www.adobe.com/products/coldfusion/flex2?sdid=RVJT

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:280320
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to