- 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
That code looks awfully familiar...
Admin
neat.
Admin
Translation: I wrote this some time in the distant past and am embarassed to admit its mine.
Admin
What's wrong with a business logic color coding scheme? If it's good enough for the Dept. of Homeland Security....er....I mean......nevermind.
Admin
I knew there had to be a better way then model classes!
I KNEW IT. Here I was using the phases of the moon.... and the pressure of the mouse clicks. (Everyone knows new people click with less pressure....)
Admin
So the problem here is using magic numbers, right?
Admin
I swear some people are writing code on acid. I'd love to be there when someone wants to change the color scheme.
[manager] We've been asked to update the color scheme to fit the corporae standard. I've got the intern on it.
[developer] Wait, the logic depends on the RGB values of the components.
[manager] What? Why?!
Now here's the game, kind of like madlibs: What's the developers response? I'd get it going but I can't even think of a reason. I need to eat.
Admin
If Form1.Picture1.Color = RGB(255,0,0) Then
MessageBox "Warning: Terror Alert Red!", vbIconExclamation
End If
Probably not proper VB, but good enough for TDWTF
Admin
This isn't a WTF: it's obvious that the programmer was working in a low memory environment so he reused the members of the UI classes as state variables rather than bloating memory with some of his own. Commendable!
Admin
There's just one flaw with that: It's VB!!!! the only programming language I know of that requres four floppies of runtime for a simple measly "Hello World" app.
Admin
<font size="2">
what's a "floppy"?</font>
Admin
The concern is that there is a set amount of magic numbers (256 * 256 * 256). It is just a matter of time before all possibilities are used up. The developer then will have to use window position or frame size for additional options. Appears to have painted himself in a corner on this one.
Admin
Yes, this is obvious. Obviously bullshit.
Admin
Its like a compact flash card, but bigger, suceptible to magnetic fields, and easily damaged. They generally hold a lot less than compact flash cards, too. See http://www.webopedia.com/TERM/f/floppy_disk.html for additional information, or simply refer to google.com
Admin
Really? Then you really aren't all that perceptive. Runtime files (usually known as Dynamic Link Libraries...you know dll files?) have been around for ages. Most OS interpretations of C++ required a few core DLLs to function. The only reason you didn't need to distribute them is that they included them with the OS usually. Do you think Pearl runs without a runtime? Java? Have you TRIED to run java without the JVM? How about Python?
Is there some magic I'm unaware of that I've been missing for all these years?
Hell, the only reason that VB had P-Code to start with was because it was actually once considered ADVANTAGEOUS. Moore's Law hadn't really taken off in the business world yet and p-code with a runtime takes less space than a compiled app on a harddrive. Now that's a moot point, but then it was big.
Now, I'm not saying VB is a stellar language, but if you are going to make a blanket statement, please don't make one that obviously makes you look like a complete and total idiot.
Do they even teach these kids anything in school these days? Yeesh.
Admin
Actually it's Fox Pro, and the quilty party was long gone before I got here.
Admin
<font size="1">
Yeah, don't validate the input or anything...wait for it fail, then change the control color.</font>
Admin
[developer] Because that's what marketing put in the requirements!
or
[Paula] I'm Brillant!
Admin
Hmmm. I wouldn't describe this as quilty. More of a highly-flammable, fuzzy, poly-blend blanket.
Admin
I think this is my favorite WTF ever. I think I want to use this concept in my current code, except I program IVRs, so I'd have to use tone of voice...
Admin
My guess: everything was so tightly seperated that the coder found no other way to determine whether or not the operation was successfull without changing that other, probably not-at-all better code.
Admin
Meanwhile, the labels on the client are changing to every color in the RGB scale so the user is wondering WTF is going on. I hope they have a color legend.
Admin
What's really sad about this is that this is exactly the kind of thinking that many developers use when trying to minimize memory footprints. Yeah, get rid of that one byte. That's going to really make a huge difference in a GUI application. Ignore all the real memory usage problems. Totally commendable, for sure.
Admin
And its data storage mechanism is based on the popular MPG database framework!
Admin
I remember seeing the same, but using images instead of colours. If the image was an "OK" icon, then it was ok. If it was a "wrong" icon, it was not ok lol
Admin
This coder did not have any memory considerations when creating this.
Admin
I think it's pretty obvious that this code's problem it has no model. The internal state and the view of it are completely coupled in unholy matrimony. I've dealt with this kind of 'design' before and it's a nightmare to maintain. Change the text of a selection and about dozen bugs appear.
Admin
I didn't think so. I was more directing that at the person who thought this was 'clearly' for memory savings.
Admin
"tightly seperated". I think I'll use this in my next presentation. My app is tightly seperated to provide context sensetive error reporting.
Admin
Of course, I'd say Java was piggish, as well. And Yes, I realise a windows app won't run without windows. But when a windows app won't run without the 4-5MB of extra garbage tacked along with it, there's something wrong. Anyway, its been established that its FoxPro, so this argument is moot.
I could go into how DOS COM files fit into 64k, needed next to nothing and could be written to not only not rely on the OS, but also no rely on the system or video ROMs. But, that would be pointless.
Can you please tell me the advantage to this? There is only ONE advantage I can think of and it surely wasn't about to pan out in VB, and that would be one of portability.
I'm not the only one to do that, believe me.
You're likely younger than I am. So, do they?
Admin
I get it - the WTF is that the colors don't match. And that everything is primary colors, which would make your eyes hurt after a while...
--Daniel T
Admin
FLAME ON!
Great response - bravo, bravo.
Admin
We all know, sometimes a well-meaning SW designer hides just too much of the (supposedly) internal state of a module, so other modules have to rely on side effects to find out what's actually going on. Of course the right way to solve that would be to change the model, but there may be other constraints (like: no time left) that make it difficult to do so; the coder of this WTF obviously thought that relying on the color is less problematic (less likely to change) than relying on the text of the label.
Admin
[developer] Because I'm a genius, Seriously.
[manager] Brillant!
dZ.
Admin
Indeed. I would have preferred a nice Mauve. Or Taupe. Lavender would also be quite soothing.
Admin
Generally, it's difficult for a view to render something that the model is hiding unless your model is a Holub-esque 'render yourself' model. So I'm wagering that there is no internal model. The business code is embedded in the controls. There is no state other than that of the gui components. I've seen it too many times to count.
Admin
I think you folks missed the boat on this one. The WTF is that it is not accessibility enabled. What if the use is color-blind? Then what is the code supposed to do? [;)]
Admin
As pointed out previously the obvious problem is that some silly manager might want to change the color of the error dialog to better match the new clock behind his desk. So obviously the best solution would be make all the colors involved configuration settings that way the maintainer can change the color of the dialogs and the color senstivity of these brillant programmic responses at the same time with out destroying the program logic. Something on the lines of :
If lblClientNum.ForeColor = wftPendingColor Then
MsgBox "Client was created but is pending activation."
ElseIf lblClientNum.ForeColor = wtfItWorkedColor Then
MsgBox "Client was created and was successfully activated."
ElseIf lblClientNum.ForeColor = wtfTotalScrewUpColor _
And lblClientNum.Caption = "999999" Then
MsgBox "There was an error creating the client. " & _
"Please ensure all required fields were entered."
End If
Admin
That's probably how this was discovered. The colors were deemed offensive but when changed, the code stopped working.
Admin
Aargh! *User*, not *use*!
Stupid EBKAC.
Admin
Nice try, but you just can't justify this level of WTFery.
Simply changing
Admin
This is about as scary a code as I've seen.
I would really like to hear the justification for this one.
Admin
Green is a primary color?
(sorry, sometimes I can't help being an asshole...)
Admin
Finally, a sensible use for Hungarian notation. [:D]
Admin
Rohhh, nice one, background color-based logic, definitly brillant [:D]
Admin
There is none.
Admin
But this requires access to the source of the SaveNewClientData procedure, which may not be the case in this project.
I aggree that this software definitely does not follow the MVC paradigm. Anyway, there could be some part of the program which could generously be considered "internal model" although it somehow has access to the controls, so it sets text and color of a label according to the result of the operation.
Admin
Let's assume the programer decided to take the label as an indicator of the success of the operation because he has no easy way to directly find out.
Relying on the color might be safer than relying on the text of the label, since the label text could be translated, corrected, contain variable parts etc. while the color is always the same for a result.
Admin
Ita erat quando hic adveni (It was that way when I got here...)
Admin
AmmoQ - with all of the defense of these WTFs the past couple of days, I beginning to think you authored quite a few yourself.
No really, why are defending such code. If what you speculate is true, then this code, and code like it, should never see the light of day.