- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
A little part of me has just died...
Admin
Yes, but perhaps this programmer is compensated the way many great writers (like Jeffrey Chaucer) were...buy the number of words. Why, he took what could have been done in four lines and expounded it to 420 eloquently written, if not slightly repetitive, lines of code!
How many times have you used i = i + 1 instead of i++ in order to make a few extra pence?
You hypocrites.
Admin
If I was paid by the line, that's some might fine code. Perhaps the coder used a for loop to generate HIS code?
Admin
LOL!
What can you say besides WTF?
Admin
It’s called loop unrolling, and it’s a speed optimization technique… but not in this case.
* Loop unrolling is reasonable if the cost of executing the loop body once is similar to the cost of checking the loop condition. Adding strings far outweighs comparing integers.
* I’d like to see him change this select into a radiobutton group, and then vice-versa :)
* Anyway, we are barking up the wrong tree here… The usability of two (three?) <select>s for hours and minutes (and seconds?) is, to say the least, questionable. One would be better off coding a single <input type="text"> and then checking for valid time formats. [Oh, skip it… that developer would probably introduce a cross-site scripting vulnerability when coding the “%s is not a valid time” error message :)]
Admin
Just one thought: what is the language? I don't know what uses [] for string delimiters, some kind of scripting thingy? Does it have the kind of loop construct we'd need?
I am intrigued, however, by the apparent absence of evidence that this fine-looking code was the product of copy-and-paste programming. I infer from the changing case of "EndIf" to "endif" that the code may just have been hand-typed from beginning to end. What a marvellous idea. And to think I doubted the assertion that good programmers are 10 times as effective as bad ones...
Admin
I'm with Mike: what's the language? Maybe this [...] expression is for some kind of pre-compiler and doesn't allow the use of variables inside. Thats the only reason I can think of that would make sense (besides paid-by-the-line). I just can't imagine a programmer who doesn't know the for loop.
Admin
The language is Visual Fox Pro 6.
- [...] is string delimiters
- and yes, there is a FOR ... NEXT and a FOR EACH loop
and Good call on the alternating case observation! I missed that one myself.
Admin
thank you so much Alex for the invitation... and this code is true... in fact many of my of my co-workers can't believe i just won
i might thank the guy that coded this =P
some stuff about Visual FoxPro 6
- VFP 6 is not case sensitive
- the if statements are endif they are not separated
- in VFP 6 you can use three string delimiters, the all known "..." and '...' and also the [...]
Admin
I just can't stop laughing...
Admin
I hope he at least used copy/paste, but I'm afraid he didn't... :D
Admin
Geoffrey Chaucer*
Admin
For loop? This is really more of an array type problem
Admin
Can I have an invite?