Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Write a bulletproof date validation routine.
I agree with almost everything ToohTooh says here.

#2 - If this were a real-world piece of code I was writing, I'd definitely make it numeric instead of text function. This was text because the challenge said it was supposed to be.

#3 - I agree that the default value should be false. It would lead to more efficient code.

#4 - I'm a bit iffy on this one. Generally, I'm in favor of splitting code apart into tiny routines. However, if I have a routine that's short--like this one--and easy to follow, I find that splitting it into more routines can make it unnecessarily difficult to follow if I have to go back to for understanding later. In my opinion, some routines are fine to have as self-contained code, particularly ones that contain no loops which can be followed easily from top to bottom.

#5,6,7,8,9 - Agreed.

Quote:You are trying to show off some kind of binary and conventional math skills, but the explanation is longer than the code itself... Your mentor wouldn't like it...

In all honesty, I was being a bit lazy. I lifted the days-in-a-month code from an earlier challenge I entered:

Moneo's been good about kicking me for writing code that's too complex for the problem. In this instance, I feel that this code would have been better for calculating base days in a month:

DinM% = VAL(MID$("312831303130313130313031", m% * 2 - 1, 2))

and Moneo's code was far simpler than mine for doing the leap-year adjustment.

Thanks for the feedback and real-world spin!



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

Forum Jump:

Users browsing this thread: 1 Guest(s)