- 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
Paid per line?
Admin
Frist
The real WTF is VB!
Admin
I guess they sort of went overboard with loop unrolling.
Admin
Created by someone who thought they were working in a DOS batch file?
Admin
Admin
Zippy, Bungle and Gawd ...
Admin
Did the author^W perpetrator of this code never think “there's got to be a better way”?
Admin
Hang on thoug, you can't put this in a loop, it's impossible, you'd never be able to get it to work. Because the last entry copies from \old\DATFIL.ZIP to \old\DATFIL.001.ZIP and it wouldn't be worth putting a wasteful and difficult-to-maintain if statement to take care of just that one instance. And you'd never be able to write a reliable program to convert "002" to "001", and "003" to "002", you'd have to write a separate if statement for each one. No, far too hard, better to write each one separately then we all know where we are.
Admin
I see it like this: V1 of the product had an 'evil loop' that just created a new backup. After a customer filled up their hard drive, they realized the evilness of unconstrained loops, and used the featured code as a solution.
A side benefit is that the unrolled loop is super-optimized.
I like how they copy to a new version instead of just renaming.
Admin
Isn't this the exactly typo of problem link is supposed to be addressing?
Admin
How do some "programmers" ever manage to get, and keep, their jobs.
Admin
That's another optimization - renaming would be racy, there might be holes in the backup chain!
Admin
This whole industry is constantly promoting code reuse. Well here's the result.
Admin
Tyr use to be regulare expresioning in Javas!
Admin
This algorithm runs in constant time. The best you could do with a loop is linear time. Last I heard, O(1) beats O(n). This implementation rocks!
Admin
Looks like it was ported from shell script. Ported altogether too literally, which is TRWTF. I can see where you'd do this with just search/replace to fill in the syntax, but no way would that be faster to do than just to write it from scratch as a loop. WTF!
Admin
Admin
My ice are bleeidink
Th payne!
Admin
You know, you could've done
Example code 68 [ ... SNIP ...] Example code 2 Example code 1
And we'd have all understood what was [Snipped]
Admin
Don't you know the authors are paid per line of... article ?!
Admin
Wish I was as clever as you to automatically know what's in between 68 and 2.
Admin
No magic numbers!
Private Const ZERO_SEVEN_ZERO As String = "070" Private Const ZERO_SIX_NINE As String = "069"
theSystem.runDOSCommand("if exist " _ & theSystem.ImportDir & "\old\DATFIL." & ZERO_SEVEN_ZERO & ".ZIP del " _ & theSystem.ImportDir & "\old\DATFIL." & ZERO_SEVEN_ZERO & ".ZIP /F") '//ADDED theSystem.runDOSCommand("copy " _ & theSystem.ImportDir & "\old\DATFIL." & ZERO_SIX_NINE ".ZIP " _ & theSystem.ImportDir & "\old\DATFIL." & ZERO_SEVEN_ZERO ".ZIP")
Admin
Admin
Admin
uhh...what?
Admin
No, thinking is for loosers, programmers type faster ;-(
Admin
Admin
Admin
Admin
The AARP called. Using "old" as a folder name is insensitive to the superannuated.
Admin
FWIW, there is a line around example code 31 which says:
TRWTF is no:
Or is it that there was a block of code/comments there which was removed at some point (either from the original code base, automagically by some "privacy cleanup" process or because it was sensitive material and was removed when submitting to TDWTF)?
Admin
I think he should get a promotion. I mean he wrote so much more code then necessary!
Admin
Admin
Might I suggest "vintage"? Or "experienced"?
Admin
slowly ducks
Admin
Aargh!
Clearly whoever wrote this monstrosity thought that Ctrl-V, edit, and repeat... was quicker than writing some kind of loop...
Admin
The real problem is an issue of required deep societal change. Our society is a century behind times when it comes to understanding of everyday objects. Electronics and software pervade our lives, yet are pretty much treated like magic. The gap is not getting any narrower either, it seems.
Hundreds of years ago, basic arithmetics and writing were done by educated people only. These days it's a skill that everyone is expected to have. We call it literacy. Time has come, too, that basic programming skills should be regarded the same way as writing and arithmetics. It's required to be a literate member of the society.
Admin
This is standard procedure on embedded systems where there is just a file system but no loops.
Admin
At least their code meets standards by concatenating a string with '&'.
Captcha: I came home today and my dog left a praesent on the floor.
Admin
You're kidding right? right, good.
Admin
This is good code, if the system ever needs to be ported to an embedded system that does not support loops this person's job is already done. They will need to make a DOS to ENIAC converter first because they are using DOS specific commands.
Admin
The real WTF is using an operating system without automatic file versioning. On VMS, you add an ACL that controls how many versions to keep - then you don't even have to think about it anymore....
Admin
This reminds me of a game I started to write in 7th grade when I was first starting to learn programming. After about the third iteration of typing in nearly identical code, I stopped and wondered "is there a better way?". Sadly back in 1982, the math teacher knew nothing about programming, despite teaching the class, and I had to wait to learn about loops. I guess some people never did learn.
Admin
I just threw up in my mouth.
In related news, Microsoft invented this product called SQL Server. Maybe these guys want to check that out sometime.
Admin
Admin
Admin
or PURGE/KEEP=30 DATFIL.ZIP
Damn, sometimes I really miss VMS...
Admin
I don't think any blind person is actually happy to be called "visually impaired"... because blind, old or fat are not swear words you know ?
Admin
Admin