|
|
|
| Hurry! Enter The Daily WTF's OMGWTF2 Contest by June 28th! - Prizes! Fame! Trophies! Do your worst: http://omg2.thedailywtf.com/ |
| « Prev | Page 1 | Page 2 | Page 3 | Next » |
|
//Comment (boring, funny, first - default value is none)
public String comment; |
|
//Status (true, false - default value is FileNotFound)
public boolean status; |
|
That's got to be the most succinct WTF I've seen in a while. I love the longer stories but the short ones leave the rest to your imagination.
|
[code] //Status (true, false, maybe - default value is FileNotFound) public Boolean statis; [/code0 FTFY |
At least the peer review process is working well... |
FTFM CATPCHA: conventio -- this article. as in this article is very conventio. |
|
The real WTF is that someone will probably post a comment claiming this isn't a WTF.
Captcha: eros - finally a captcha I can endorse wholeheartedly. |
|
Okay, so he made the status a string. Probably not the best option; I'd have used an enum or something. Also, it being a string with (I'd expect) a finite range of possible values, making it public probably isn't a good choice either. Words like "best practice" and "quality" certainly don't come to mind here. But I suppose it'll work, as long as no one abuses the unneeded flexibility of a public string.
I can appreciate that the comment lists the range of possible values for status (probably the only "best practice" shown), although my prior observations leave me doubtful of the comment's accuracy. So at this point, unless I'm missing something obvious I'd almost say that it's "not really a WTF". Except then I examine the following bit:
Someone please find this code's author and shoot him. |
Almost, but not quite. |
|
Fixed?
//Status (none, active, finished - default value is none) |
Better: //Status (none, active, finished - default value is none) Certainly not fixed. |
Sounds like you don't have much real-world experience (well, not experience with J2EE, anyway). When you graduate, you may find that 1) there are many things that are configured using XML, and 2) developers hate writing XSDs (or DTDs either for the pedantic). When you write objects to map to the strings found in the XML produced by outside vendors, there is literally no way to determine beforehand what string values will be. Furthermore, it may not even be necessary to know, since you later just convert back to XML and send or simply persist to the database. |
FYI, that's a terrible way to do initializations if you anticipate the class being extended in the future. |
Reading comprehension fail. While you might be forgiven for not realizing their's a category called "Representative Line," your not forgiven for failing to read that fact stated implicitly in the story. |
|
var comment:String = new String();
comment = "this post sucked"; trace("Alex, come on."); Yes, I know my post is as lame as the article, but I'm not very inspired. But this "article" wasn't either. No redacted reference to what this "large logistics company" was. (Fedex? UPS?) Or even the slightest reference to what part of the code that logic applied to. Even if it was a general function, a little more back store would make it more entertaining reading. I guess it's the whole "Representative Line" theme. But in my likely to be flamed opinion, this line represents nothing to me. Captcha: refoveo Red rover, red rover, come oveo and gimme a better wtf. |
And you're not forgiven for you incorrect use of the word "your". Captcha: Ingenium...perhaps your use of the word was "ingenium". |
|
There may well be cases where a string is the best status, I'd say that in most cases its a poor choice. I prefer my types to indicate something useful. Certainly, thats no basis for impuning someone's real world experience.
|
|
Did I mention I hated this article? Maybe it's the Christmas anti spirit.
Deck the forums with balls of stupid, fa la la la la. Noel, noel, no elohel. The First no elohel, the Angels didn't say Was to certain poor posters in fields as they say In fields where they lay keeping their posts up to date On a cold Wednesday day that was so deep. elohel, elohel, elohel, elohel Born is the King of Weak Posting! Captcha: tation Temptation to be more abbreviated. |
|
default value = false means that there IS NO default value!!!
|
FTFY |
As many have alluded to with the "default value = none" comments, I hope. Seriously though, if this was the worst WTF that could be found in the entire codebase... then you must be one whiny and weak programmer. Especially considering that with zero context, 50% of the commenters here have been able to come up with a logical and well-fitting explanation for the comment+code line. That's not to say that those 2 lines aren't poor, lazy, or both... just that they're really weak for a "representative" wtf. |
|
//Status (none, active, finished - default value is wtf)
public String status; |
|
And the fact that the entire J2EE world is basically one big WTF is a defense how, exactly?
|
Almost: //Result (none, active, finished - default value is false) There we go. Very enterprisey. |
Wow, such seemingly-uncalled-for disdain over a tongue-in-cheek comment. I must have really hit a nerve. Perhaps this was your code? |
Oh really? Terrible, you say? That extreme is it? Do explain. |
Unfortunately, it seems that most people just can't resist the opportunity. |
Hahahahahaha! Funniest comment I've read in a long time. |
Well we don't know what the string is used for, perhaps it is the value that is being displayed to the user. A string seems slightly better than an enum in that case. TRWTF is the story. The code base is apparently a heaping mass of dung, and the representative line is a comment that isn't quite accurate? Seriously? Is the problem a lot of comments that are wrong, or that it uses a lot of public variables? Man if this is the worst the code has to offer, AND it sums it all up, then the code is probably pretty nice. |
Now you know why I used the qualifier "probably". Honestly though, you're right; it's hard to say what the best option would have been without seeing the code in context. |
Even if it's being displayed to the user, you shouldn't have the string be public. |
The String has to be public to be accessed using Reflection (legally). Yet another indication that this is the right datatype. |
The Ballad of Punkin Pie
2010-12-22 15:30
•
by
Billy Milano
(unregistered)
|
*Dun Duh* *Dun Duh* *Dun Duh* YOU'RE DUMB! |
And you're not forgiven for your incorrect use of the word "you." |
I think you got you're your's mixed up their, buddy. |
Muphrey's Law... Every fuck time! It almost never fails. PS: How can I make something bold in this forum??? |
And you're not forgiven for mispelling "Grammar". </pedantic> |
Right, because reflection is always an indicator of "good software design", and is apparently relevant when simply displaying a value to the user (as suggested in this example context). Maybe you're just trolling now? |
This is the real WTF... |
Easiest way to troll on this forum is using "your" in place of "you're." The troll has earned more comments than the article. |
|
Good Lord, what a bunch of banal replies...
|
Standard BBCOde...Square braces [] bold not bold |
By using the appropriate BBCode, there's a ling directly above the edit box. |
Re: Status
2010-12-22 16:00
•
by
More Grandma Nazis
(unregistered)
|
I have to assume the mistake was deliberate.... misspelling (mis prefixed to spelling) The wiggly red line underneath tells you that it's spelt (spelled, apparently) wrong |
|
Who hasn't written a comment like this?
|
Man, you're stupid. How hard is it to hit dictionary.com? |
+1 for "enterprisey" |
Re: Status
2010-12-22 16:24
•
by
ÃÆâ€â„
(unregistered)
|
They only know TDWTF. This is where they satisfy their urge to correct other people and/or pick up little boys. |
|
| « Prev | Page 1 | Page 2 | Page 3 | Next » |