Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Write a bulletproof date validation routine.
#54
Quote:I prefered your method of hard coding the number of days per month, whilst i enjoyed the other posts methods of determing the number of days in a month (complicated, but interesting), I agree with the idea of keeping it fairly understandable when possible.

I like the IsLeapYear function also, I guess at first i would have been tempted to write a multiline IF..THEN based code, but it really is not necessary as shown in yours. Earlier in the thread you said you felt your IsLeapYear was overcomplicated, but i disagree, i felt it was still very understandable.
Yeti, thanks for you constructive comments. I think we are now pretty much in agreement on all the coding issues of this task.

I hope we have impressed on others the need of having such a date validation routine tested and ready to be used in any program which receives a date as input from the user or even as input from another file.
Most programs don't contain good date validation logic simply because the programmer doesn't want to take the time to do it and test it while writing the main program. Often, the same happen with other validations like numeric amounts, numerics with decimals, validating codes, zipcodes, phone numbers, name and address fields, etc. These can be a pain in the butt if you don't have the logic ready-made, so they usually go unchecked --- "garbage in, garbage out."

Regards..... Moneo
Reply


Messages In This Thread
My entry - by Meg - 10-11-2004, 09:03 PM
updated - by Meg - 10-12-2004, 08:01 PM
/nod - by Meg - 10-23-2004, 01:34 AM
Foo - by ToohTooh - 10-26-2004, 10:36 PM
Reply on Clarification Suggestion - by Neo - 10-26-2004, 11:37 PM
Re: Reply on Clarification Suggestion - by oracle - 10-27-2004, 02:00 AM
Hmm... - by ToohTooh - 10-27-2004, 02:12 PM
Re: Hmm... - by Neo - 10-27-2004, 10:12 PM
Thank you. - by ToohTooh - 11-01-2004, 04:54 PM
Write a bulletproof date validation routine. - by Moneo - 07-29-2006, 04:11 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)