| « Prev | Page 1 | Page 2 | Page 3 | Page 4 | Next » |
|
The only relevant response is this: bottom fish banana.
|
|
Comment line 1 is in date format
("Maybe I'm frist"). |
|
well, the logic behind this is, uhm...
a) nonexistent b) fuzzy c) an indicator of what horrors might be hidden on that codebase d) a testimony to the higher-ups's stupidity, for not allowing such crap to be overwritten with something sane e) all of the above |
|
My favorite part is the nonsensical "&& string.IsNullOrEmpty(processingClient.StreetAddress.Line1)" in the outer if.
|
|
I have a fix for you. a /* before the for statement, a */ at the end of it. Replace with nothing.
CAPTCHA: paratus, pair of what you say? |
|
I'm sure there's a street somewhere in Liverpool called "Octopus Gardens..."
This code is quite brillant, in fact. It goes way beyond the traditional temptation to be "paid by the line." It's actually the first WTF I've seen that clearly has no possible utility whatsoever. |
|
Btw, what language is that? String, string and IsNullOrEmpty suggest C#, but the `for (String month : months)` is not C#-y. Anonymization gone wrong?
|
|
More validation is always better. We can't have our data jumpin' around all nimbly-bimbly from tree to tree...
|
|
Hope there's no October Road in Scunthorpe.
|
|
I wondered why I couldn't order anything off you guys.
Regards -- Jane Doe 42 Juliet Place Marchwood |
|
Great stuff, there has to be a ton of street names that will run foul of this:
Mayflower Juliet Mars |
FTFY, It should work now. |
Whoops, missed one. |
Re: October Road
2010-03-03 10:18
•
by
Seminymous Coward
(unregistered)
|
http://thedailywtf.com/Articles/The_Brillant_Paula_Bean.aspx and http://thedailywtf.com/Articles/The_Brillant_Paula_Strikes_Back.aspx will fix that. http://thedailywtf.com/Articles/Web_0_0x2e_1.aspx can help unless you want to be very stubborn. |
Damn, thats what i was going to put but comments were not working..... at least they are working now: ("Comment Line %i is in date format", &line) |
There is no room in programming for logic. |
Re: October Road
2010-03-03 10:20
•
by
Quirkafleeg
(unregistered)
|
C++ (well, C++0x, or C++1x as it should be known now) has that construct. |
Re: October Road
2010-03-03 10:21
•
by
Anonymous
(unregistered)
|
Nope, it's Java. This syntax is often referred to as the enhanced for statement and it is used for iterating collections and arrays. This is actually the recommended way of structuring a for statement in Java, according to Sun. |
|
I have absolutely no idea as to why anyone would do that to their system, but I guess that the developers did not grow up in my hometown:
Google map link to a load of streets, all named after months ... |
|
Source line 3 is in date format ( "Jan", "Feb", "Mar", ).
Source line 4 is in date format ( "Apr", "May", "Jun", ). Source line 5 is in date format ( "Jul", "Aug", "Sep", ). Source line 6 is in date format ( "Oct", "Nov", "Dec"). |
Re: October Road
2010-03-03 10:28
•
by
Augusto Novo from Decatur, IL
(unregistered)
|
And I'd thought you boycotted our whole town ... |
|
I can guess what happened here. The database was initially seeded from a whole bunch of externally-supplied files, some of which were in a format different from what was expected, having dates where addresses were expected. We've done similar things in the past.
In order for the app to detect that such a file was of that format, this snippet was written (by an intern, as this is the sort of thing you give rookies to program). Unfortunately, due to some configuration management mistake, it made it to production. And the guy who was initially behind this code snippet (the bloke who initially told the intern / student what to do) is no longer around. |
I'd like to be under the sea In an octopus' garden in the shade He'd let us in, knows where we've been In his octopus' garden in the shade |
And C++ has the flexibility (C macros, overloading) to impersonate other languages or combination of languages. Although, it could be J#. |
There seems to be as little logic to that street layout as to the code snippet. If you're walking along Nørregyde you get: Jul Jan Feb Aug Mar Sep Oct May Apr. If you do it N->S it's: Apr May Jan Feb Mar Jul Aug Sep Oct I haven't managed to find June and it seems they couldn't be bothered to finish the sequence off with Nov & Dec? |
|
This system is clearly in need of some upgrades - it isn't even internationalized to support multiple languages...
What if someone enters a date in french?!? |
Stubborn as in actually using the word "brillant" in my post? I'm not talking about WTFs that clearly fail to do what they're supposed to do. I'mm talking about this WTF being so useless that, as the OP said, it's impossible to work out what problem the stupid thing was meant to do in the first place. |
|
BA: The users want the system to identify addresses that may be dates.
DEV: Wha!?!?!? BA: The users want the system to identify addresses that may be dates. DEV: That sounds pretty dumb, what problem are they trying to solve? BA: That the system doesn't identify addresses that may be dates. DEV: Uh...but... This is just an example of what happens when you are given solutions instead of requirements. |
There. I fixed it. |
|
I suspect the intent of this code is to scold the user if they accidentally fill in the address line 1 with a date (i.e. the field above is a date field and they occasionally run into issues with people misaligning their information).
|
|
Couldn't it also be written in D ? (although this one hasn't been used a lot ^^)
|
|
Wow. Standing ovation. This one's an instant classic.
|
Re: October Road
2010-03-03 10:47
•
by
Anonymous
(unregistered)
|
But hang on, Java doesn't have a IsNullOrEmpty on the string class and it uses lower case method names (eg 'contains' instead of 'Contains'). The code looks just like C# but the enhanced for is taken straight out of Java (after all, C# has the "foreach" construct which is it's own way of implementing Java's enhanced for). So I'm a bit confused as to the origins of this snippet, it certainly does look like two different langauges. |
Good point. In that case DateTime.TryParse() or it's equivalent would be much more appropriate than that crap. |
Re: October Road
2010-03-03 10:47
•
by
Quirkafleeg
(unregistered)
|
Meta-comment. You win one tube-clogging Internet. |
Is this supposed to be "!string.IsNullOrEmpty()"? Since this loop will only run if Line1 is null or empty, the condition "processingClient.StreetAddress.Line1 != null && processingClient.StreetAddress.Line1.Contains(month)" will always be false, won't it? Unless month is the empty string, in which case it will always be true (I think--I'm not sure if every string Contains the empty string, but I suspect they do). |
I'm curious as to why they would need to add or change anything... the only time that this code would ever run is if "processingClient.StreetAddress.Line1" is empty or null... Admittedly the code is a WTF, but so are the statements made about it... |
|
“Our codebase is a bit... backwards, to say the least,” writes Aaron Silver, “things that should go up don’t go up or down... instead, they&rsqou;re painted orange .”
1. Non-existent character entity 'rsqou' 2. Even if it were spelled correctly, it should be an 'apos' rather than an 'rsquo'. 3. Superfluous space before terminating period. 4. Metaphor nonsensical. |
Re: October Road
2010-03-03 10:54
•
by
Anon Ymous
(unregistered)
|
Clearly, the addresses are copied and pasted from an Excel spreadsheet, which has the annoying habit of converting things that are not dates to date format. |
|
The thing is... the whole block is only called if processingClient.StreetAddress.Line1 is null or empty, so if that's the case why would they decide that it needed a check to see if it contains a month? And why is it OK for lines to contain months if line1 is NOT null or empty?
|
Re: October Road
2010-03-03 10:58
•
by
Anonymous
(unregistered)
|
That first IsNullOrEmpty prevents the block from executing if nothing has been entered into the address Line1 field. In other words, only perform this (crappy) address validation if an address (or at least the first line of an address) has been entered. Not sure what you mean about every string containing the empty string. If you call the 'Contains' method on an empty string (ie length=0), it will only match another empty string (ie length=0). |
If you listen carefully, you'll notice the Beatles got their apostrophes right. I'd like to be under the sea In an octopus's garden in the shade He'd let us in, knows where we've been In his octopus's garden in the shade Just the one octopus, so it takes "'s" |
+1. One of those must be the explanation. |
|
Actually, now I come to think about it, the lyrics don't just repeat the "octopus's garden" line like that. The point stands though.
|
Re: October Road
2010-03-03 11:02
•
by
Anonymous
(unregistered)
|
Oh, but it isn't !IsNullOrEmpty at all! OK, so I'm guessing this was a transcribing error. I'm sure that first call to IsNullOrEmpty is supposed to be !IsNullOrEmpty. |
|
1) ’ = right single quotation mark
rsquo ’ U+2019 (8217) HTML 4.0 HTMLspecial ISOnum right single quotation mark Presumably put in the html as ’ as we see it like that. 2) the code snippet will rarely execute the for loop as the frist line of the address is unlikely to be blank if this is behind a UI. So random testing will be unlikely to find the problem. WTFIFWWY ! |
Steve Holt! |
Re: October Road
2010-03-03 11:09
•
by
Quirkafleeg
(unregistered)
|
I don&rsqou;t think so. It&rsqou;s perfectly clear, not to mention obvious, that they should be painted purple. |
Except it doesn't negate the check, so it'll never happen. |
| « Prev | Page 1 | Page 2 | Page 3 | Page 4 | Next » |