- 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
Admin
I'm all out of quatloos, do you accept internets?
Admin
[inb4 "no u"]
Admin
Admin
We threw away the "implementation" and cooked up one ourselves; it later served as the "example code" for the next generations, who we warned not to waste their time with the textbook "example".
Admin
Admin
So what's the problem? I'm sure that in the code that processes this input, he simply writes:
It makes perfect sense when you envision the application as a whole.
Admin
I don't get it. What was the problem again?
Admin
I don't get it. What was the problem again?
Admin
I don't get it. What was the problem again?
Admin
I don't get it. What was the problem again?
Admin
break; // combo breaker!
Admin
You spend way too much time thinking about my arse. I guess it's my own fault for raising it.
rimsho--errr, I mean "ba-da-dum-tissh"
Admin
i rarely post saying this shouldnt be on here... he is a novice, and obviously didnt understand not really a WTF? the fact that it reached here is more likely to be the WTF!
Admin
Admin
I think that's the "Replace Conditional with Polymorphism and Conditional" refactoring.
Admin
Could be that he intented to make each case different later then forgot or changed his mind but didn't rewrite the code
Admin
Technically, it isn't cargo cult, it's just stupid code.
CCP requires the use of an idiom that doesn't do anything, the author doesn't understand, but is there because it was thought to fix something in the past, and so is always used.
Admin
Admin
Here's a hint kid. When you're making a witty retort, try to make it witty.
Admin
Sigh, glad I am not the only one to deal with hard coded year drop downs. Towards the end of my first year at my first job, a user of the application I recently was assigned to maintain came over and she asked me, "Could you add a new year to the call center? Lula, used to do it for us every year, but I don't know who could do it now?"
My boss fired the only female programmer and I took over all her crap. The users hated that she was fired and I took over but after a while of them working with someone that could speak english and could write code that didn't need updated every year they started to warm up to me.
Admin
Admin
I've requested to have a project manager meet with the customer to find out what the date range represents and what its bounds should be, so that I can generate the listitems dynamically. Whether that gets approval or not remains to be seen.
Admin
Then there are the textbooks that are obsessed with linked lists and recursion. I've even seen one that recommended using recursion to get from one end of a linked list to the other.
TRWTF: the original code didn't use recursion to "reuse the code".
Admin
I think everyone got your obvious (attempt at a) joke. The point was that you just picked a bunch of random words to make up the acronym. You might as well have called it "Phone Elaine Now Igor Samsonov".
Admin
Unfortunately I did, yes! I even divided by 365.25 to take account for leap years AND rounded up to cut you some slack (note to self - leave the house more often).
Wait a second... you said 'arse' then 'math'. Shouldn't that be 'ass' then 'math' or 'arse' then 'maths'?
Admin
Isis is the earth-mother, the goddess of fertility.
Nubile means a female of consenting age, sexually active.
Emulation means aspiring to be like someone, as good as or better than them, imitating their activity.
So what we have here is someone doing her personal best to become a young sexually active goddess of fertility.
Oh, wait... we forgot "Society". It isn't one... it's a whole fellowship of them! A society of young sexually active fertility goddesses: a brothel. Or maybe it's a temple full of priestesses of Isis.
But don't feel bad because you didn't get that. "Liberate Apes Before Imprisoning Apes" really is more your speed. So go on back and play with the other kiddies now, and let the adults tend to the grownup stuff.
Addendum (2009-03-11 22:08): By the way... good move, going anonymous for your post. Really good move.
Admin
People who use underscores as the first character of variables need to be punched.
Seriously.
if (_somevar != _start_date) { _blow_chunks.add (_chunk); _chunk.isChunky = true; }
--_doSomeMoreShit;
if (_chunk.isChunky && 0 >= _blow_chunks.Length && _doSomeMoreShit++ > 1) { for (int _x = 0; _x < _theNumberOfHairsOnMyHead; _x++) _hairs_left -= _x; }
Try debugging that shit at midnight.
Admin
That only looks like each case does the same thing. I've "worked" on enough enterprise software to know the real design pattern here. DetailPanelFactory.getInstance uses reflection on it's return address to determine which case branch it was called from.
Admin
Admin
Admin
While all the above is true, a quick perusal of the MSDN documentation shows that M$ appears to be using the underscore for all privately scoped variables. input variables for methods use no underscore, and public variables (invariable a property) uses a capital.
As such, I don't find it at all surprising that this programming style has been picked up by the masses. However, when every single variable in every single form uses underscores, which happens when the idea is misunderstood, it becomes amazingly complex very fast.
In response to the earlier persons "code snippet" that they said to debug late at night, for one, camel case should be being used if using the underscore for privately scoped variables mentality, and for two (and much more importantly) your design style changed for a number of variables, with some having camelCase and some having under_scores. Pick one and stick to it, will make your code much more maintainable at midnight.
Admin
I'm leaving on friday. I'm glad I dont have to keep exposing myself to this.
Admin
would this be appropriate?
case CONST1: case CONST2: case CONST3: HideousEnterpriseyClassFactoryFactory.CreateHideousEnterpriseyClassFactory() break;
Admin
What about:
There should only be ONECONST, seeing as it seems to be same type of object, then you just
def Panel_Instance(VARIABLE) _panelInstance = DetailPanelFactory.getInstance(VARIABLE); _panelInstance.parseXML(panelList); // add the new panelItem to the panelCollection _panelCollection.addItem(_panelInstance); end
Panel_instance(ONECONST)
DONE!
Admin
EEK, s/ONECONST/VARIABLE/g
Admin
Utterly redundant code comments are annoying:
"// add the new panelItem to the panelCollection"
Admin
No, they literally couldn't log calls for the next year's events because they couldn't pick the next year and the user was the project manager. The company was pretty well run from the business side, virtually no red tape, just I replaced a shitty programmer that just hard coded "2004", "2005", "2006" into a drop down.
Admin
ding! fries are done!
Admin
How is this not a WTF? Some Paula was hired to write code. Sure they are new, but they were HIRED to write code, and this is what they produced. Sure maybe Paula was hired to be trained on the job, but I seriously doubt that.
Admin
That's called the "Mirror with Distortion" or "Carnival Mirror" Design Pattern. We see it a lot around these parts.
Admin
The real WTF are the comments in code.
a much more stringent version:
Only code which is explained twice will be understood from the compiler :_)
Admin
omg
Admin
no, the real wtf is copy-pasta they should have written it as case SOME_CONST1: case SOME_CONST2: case SOME_CONST3: case SOME_CONST4: _panelInstance = DetailPanelFactory.getInstance(type); _panelInstance.parseXML(panelList); // add the new panelItem to the panelCollection _panelCollection.addItem(_panelInstance); break;
or use an if statement in a similar fashion
Admin
You bitwise-or together your constants?
Admin
I suppose the option to fire the developer was not considered?
Admin
This is what the book "Code Complete" recommends, FWIW. Explicit case statements for each condition, rather than relying on fall-through. 'course, the design could probably be reworked, but this one snippet looks "OK" according to CC's rules.
Admin
I can actually top this. Some code that I found in one of our many Access/VBA monstrosities...
"Not that bad," you might say, "aside from the hideous code and ridiculous comments, that sounds like a halfway decent idea". But wait. Scroll down, and you find that the other 20 buttons on the form have On Click events that look strangely familiar: After looking at the On Click events for all 21 buttons on the form, I found that this clever programmer's function to avoid "repeating the same code in multiple event procedures" gets used a grand total of exactly once.