Patrick McElhaney wrote:

>You should avoid returning null if possible. 
>
>For numeric values, a common practice is to return a number outside
>the range of possible values.  For example, the find() function in
>ColdFusion returns the position of the substring in a string, which
>must be a positive integer. If the substring isn't found, it returns
>0.
>
>Patrick
>
>  
>
I agree with Patrick for the most part.  The only problem is when the
range of the value returned is infinite and unrestricted because your
returned "null" value is something like -999999999999999 which is much
harder to work with.  By that time, I tend to just return "" and make
the type "string".  This doesn't happen often as usually -1 is out of
range for a lot of things. etc.

.Peter

-- 
Peter J. Farrell :: Maestro Publishing
http://blog.maestropublishing.com

Rooibos Generator - New Version! - Version 2.1
Create boilerplate beans and transfer objects for ColdFusion!
http://rooibos.maestropublishing.com/

Member Team Mach-II - It's coming...



----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to 
[email protected] with the words 'unsubscribe cfcdev' as the subject of the 
email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting 
(www.cfxhosting.com).

CFCDev is supported by New Atlanta, makers of BlueDragon
http://www.newatlanta.com/products/bluedragon/index.cfm

An archive of the CFCDev list is available at 
www.mail-archive.com/[email protected]


Reply via email to