[EMAIL PROTECTED] wrote on 30/11/2004 08:56:14 AM: > Now, we all know that SSNs are nine-digit numbers.
Not all of us, ie I'm Awustraaliaan mate ;) hehhe. > QUESTION 1: > What should happen if I pass a number that is not nine digits? > Should it throw an error or just return the passed value back to the > page? Look at it in both contexts of normal, formatted, SSN output > as well as the masked SSN output. Personally i think the UDF should simply throw an exception that or return a contract back out eg contract: result = StructNew(); result.success = true|flase; result.message = "only if the above is false do you provide a satisfactory error message" result.data = "any data you manipulated or sent in originally" My personal preference is to throw an exception (its not really a hard error, its more of a "ooops" hiccup), that way that UDF is used universally and no constraints are put in place (ie if you use the contract, whenever you use it now it also has to adhere to the result stack). Its then up to the end user to cater to its needs (ie i think the same rule applies with say a method expecting a numeric value and you pass in a string, syntax is out so it throws an exception). > QUESTION 2: > Should my UDFs prepend leading zeros to the beginning of any number > that is less than nine-digits? Or, should that have been done prior > to the UDF usage? Both. Depending on your need and the purpose. Personally if you expect a min/max range on an argument, it would be wise to cater for this inside the UDF's logic. I think the upcoming Blackstone release will also have this capability in place (min/max - via Ben Fortas Blog). So, If a user passes in 4 digits only, then you could assume to return a masked version (why i have no idea). If a user passes in 9 digits, then its syntatically correct and do whatever is needed to carry out your UDF. > One solution is to have the UDF do a lot of code in itself, but > then, it would limit its usage later on. The other solution is to > create multiple, smaller UDFs that do only a single task, but then > that would require more UDF nesting. What gains will you get by breaking them up in that, will they be re-used? is there a need for it? are you breaking them up to reduce the UDF's size only and thats all? If its the later, i'd rather have 50 line UDF then 2x25 line UDF's that serve no purpose other then code tarting up. I'm no guru by any stretch, but thats what i'd do in the case you've provided. Scott Out. To unsubscribe from this email please forward this email to [EMAIL PROTECTED] This email message is confidential and may be privileged. If you are not the intended recipient please forward the email to [EMAIL PROTECTED] and delete the original. ABN AMRO Morgans Limited and its associates hold or may hold securities in the companies/trusts mentioned herein. Any general advice included in this email has been prepared without taking into account your objectives, financial situation or needs. Before acting on the advice, you should consider its appropriateness or discuss with one of our investment advisors. ABN AMRO Morgans Limited (ABN 49 010 669 726 AFSL 235410) A Participant of ASX Group. A principal member of the Financial Planning Association. ---------------------------------------------------------- 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 [EMAIL PROTECTED]
