Comment On October Road

“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’re painted orange .” [expand full text]
« PrevPage 1 | Page 2 | Page 3 | Page 4Next »

Re: October Road

2010-03-03 10:05 • by SR (unregistered)
The only relevant response is this: bottom fish banana.

Re: October Road

2010-03-03 10:05 • by spxza
*bangs head on desk

Re: October Road

2010-03-03 10:06 • by the beholder (unregistered)
Comment line 1 is in date format

("Maybe I'm frist").

Re: October Road

2010-03-03 10:07 • by the beholder (unregistered)
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

Re: October Road

2010-03-03 10:08 • by Seminymous Coward (unregistered)
My favorite part is the nonsensical "&& string.IsNullOrEmpty(processingClient.StreetAddress.Line1)" in the outer if.

Re: October Road

2010-03-03 10:09 • by deezil (unregistered)
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?

Re: October Road

2010-03-03 10:10 • by Bim Job (unregistered)
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.

Re: October Road

2010-03-03 10:11 • by Sad Bug Killer
Btw, what language is that? String, string and IsNullOrEmpty suggest C#, but the `for (String month : months)` is not C#-y. Anonymization gone wrong?

Re: October Road

2010-03-03 10:12 • by Nibh (unregistered)
More validation is always better. We can't have our data jumpin' around all nimbly-bimbly from tree to tree...

Re: October Road

2010-03-03 10:13 • by Anon (unregistered)
Hope there's no October Road in Scunthorpe.

Re: October Road

2010-03-03 10:16 • by Anonymous (unregistered)
I wondered why I couldn't order anything off you guys.

Regards
--
Jane Doe
42 Juliet Place
Marchwood

Re: October Road

2010-03-03 10:16 • by Anon (unregistered)
Great stuff, there has to be a ton of street names that will run foul of this:
Mayflower
Juliet
Mars

Re: October Road

2010-03-03 10:17 • by Anon (unregistered)
300805 in reply to 300803
Anonymous:
I wondered why I couldn't order anything off you guys.

Regards
--
Jane Doe
42 Ju liet Place
Ma rchwood


FTFY, It should work now.

Re: October Road

2010-03-03 10:18 • by Anon (unregistered)
300806 in reply to 300805
Anon:
Anonymous:
I wondered why I couldn't order anything off you guys.

Regards
--
Ja ne Doe
42 Ju liet Place
Ma rchwood


FTFY, It should work now.


Whoops, missed one.

Re: October Road

2010-03-03 10:18 • by Seminymous Coward (unregistered)
300807 in reply to 300799
Bim Job:
It's actually the first WTF I've seen that clearly has no possible utility whatsoever.


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.

Re: October Road

2010-03-03 10:18 • by Helix
300808 in reply to 300792
the beholder:
Comment line 1 is in date format

("Maybe I'm frist").


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)

Re: October Road

2010-03-03 10:19 • by PITA (unregistered)
300809 in reply to 300793
the beholder:
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
There is no room in programming for logic.

Re: October Road

2010-03-03 10:20 • by Quirkafleeg (unregistered)
300810 in reply to 300800
Sad Bug Killer:
Btw, what language is that? String, string and IsNullOrEmpty suggest C#, but the `for (String month : months)` is not C#-y. Anonymization gone wrong?
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)
300811 in reply to 300800
Sad Bug Killer:
Btw, what language is that? String, string and IsNullOrEmpty suggest C#, but the `for (String month : months)` is not C#-y. Anonymization gone wrong?

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.

Re: October Road

2010-03-03 10:22 • by Don Petrus (unregistered)
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 ...

Re: October Road

2010-03-03 10:25 • by Quirkafleeg (unregistered)
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)
300816 in reply to 300803
Anonymous:
I wondered why I couldn't order anything off you guys.

Regards
--
Jane Doe
42 Juliet Place
Marchwood


And I'd thought you boycotted our whole town ...

Re: October Road

2010-03-03 10:30 • by Matt Westwood (unregistered)
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.

Re: October Road

2010-03-03 10:32 • by PITA (unregistered)
300819 in reply to 300799
Bim Job:
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.
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

Re: October Road

2010-03-03 10:33 • by frits
300820 in reply to 300810
Quirkafleeg:
Sad Bug Killer:
Btw, what language is that? String, string and IsNullOrEmpty suggest C#, but the `for (String month : months)` is not C#-y. Anonymization gone wrong?
C++ (well, C++0x, or C++1x as it should be known now) has that construct.


And C++ has the flexibility (C macros, overloading) to impersonate other languages or combination of languages.
Although, it could be J#.

Re: October Road

2010-03-03 10:34 • by the real wtf fool
300821 in reply to 300812
Don Petrus:
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 ...


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?

Re: October Road

2010-03-03 10:34 • by Kempeth (unregistered)
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?!?

Re: October Road

2010-03-03 10:35 • by Bim Job (unregistered)
300824 in reply to 300807
Seminymous Coward:
Bim Job:
It's actually the first WTF I've seen that clearly has no possible utility whatsoever.


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.
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.

Re: October Road

2010-03-03 10:39 • by Bobble (unregistered)
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.

Re: October Road

2010-03-03 10:40 • by frits

/*
string[] months =
{
"Jan", "Feb", "Mar",
"Apr", "May", "Jun",
"Jul", "Aug", "Sep",
"Oct", "Nov", "Dec"
};

if (processingClient.StreetAddress != null
&& string.IsNullOrEmpty(processingClient.StreetAddress.Line1))
{
for (String month : months)
{
if (processingClient.StreetAddress.Line1 != null
&& processingClient.StreetAddress.Line1.Contains(month))
{
writeError(processingClient,
errorList,
"Street address line 1 is in date format ("
+ processingClient.StreetAddress.Line1 + ").");
}
if (processingClient.StreetAddress.Line2 != null
&& processingClient.StreetAddress.Line2.Contains(month))
{
writeError(processingClient,
errorList,
"Street address line 2 is in date format ("
+ processingClient.StreetAddress.Line2 + ").");
}
if (processingClient.StreetAddress.Line3 != null
&& processingClient.StreetAddress.Line3.Contains(month))
{
writeError(processingClient,
errorList,
"Street address line 3 is in date format ("
+ processingClient.StreetAddress.Line3 + ").");
}
}
}
*/





There. I fixed it.

Re: October Road

2010-03-03 10:43 • by toth
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).

Re: October Road

2010-03-03 10:45 • by toshir0
300828 in reply to 300820
Couldn't it also be written in D ? (although this one hasn't been used a lot ^^)

Re: October Road

2010-03-03 10:45 • by Anonymous Coward (unregistered)
Wow. Standing ovation. This one's an instant classic.

Re: October Road

2010-03-03 10:47 • by Anonymous (unregistered)
300830 in reply to 300811
Anonymous:
Sad Bug Killer:
Btw, what language is that? String, string and IsNullOrEmpty suggest C#, but the `for (String month : months)` is not C#-y. Anonymization gone wrong?

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.

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.

Re: October Road

2010-03-03 10:47 • by frits
300831 in reply to 300827
toth:
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).


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)
300832 in reply to 300826
frits:
/*

string[] months =
{
"Jan", "Feb", "Mar",
"Apr", "May", "Jun",
"Jul", "Aug", "Sep",
"Oct", "Nov", "Dec"
[…]
*/
There. I fixed it.
Meta-comment. You win one tube-clogging Internet.

Re: October Road

2010-03-03 10:48 • by toth

if (processingClient.StreetAddress != null
&& string.IsNullOrEmpty(processingClient.StreetAddress.Line1))
{
for (String month : months)
{
if (processingClient.StreetAddress.Line1 != null
&& processingClient.StreetAddress.Line1.Contains(month))
{
writeError(processingClient,
errorList,
"Street address line 1 is in date format ("
+ processingClient.StreetAddress.Line1 + ").");
}


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).

Re: October Road

2010-03-03 10:51 • by md5sum
Alex Papadimoulis:
Aaron adds, Aaron adds, “I’m not exactly sure what thought process lead to this, but the powers that be aren’t too keen about changing it, leaving our end users to adding random hyphens and spaces for those unfortunate enough to live on ‘October Road’.”
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...
Alex Papadimoulis:
if (processingClient.StreetAddress != null
&& string.IsNullOrEmpty(processingClient.StreetAddress.Line1))
{
...
}
Admittedly the code is a WTF, but so are the statements made about it...

Re: October Road

2010-03-03 10:52 • by Rootbeer
“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)
300836 in reply to 300824
Bim Job:
Seminymous Coward:
Bim Job:
It's actually the first WTF I've seen that clearly has no possible utility whatsoever.


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.
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.

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.

Re: October Road

2010-03-03 10:56 • by Clax (unregistered)
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)
300838 in reply to 300833
toth:

if (processingClient.StreetAddress != null
&& string.IsNullOrEmpty(processingClient.StreetAddress.Line1))
{
for (String month : months)
{
if (processingClient.StreetAddress.Line1 != null
&& processingClient.StreetAddress.Line1.Contains(month))
{
writeError(processingClient,
errorList,
"Street address line 1 is in date format ("
+ processingClient.StreetAddress.Line1 + ").");
}


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).

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).

Re: October Road

2010-03-03 10:58 • by John (unregistered)
300839 in reply to 300819
PITA:
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


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"

Re: October Road

2010-03-03 11:00 • by kftt (unregistered)
300840 in reply to 300817
Matt Westwood:
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.


toth:
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).



+1. One of those must be the explanation.

Re: October Road

2010-03-03 11:01 • by John (unregistered)
300842 in reply to 300839
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)
300843 in reply to 300838
Anonymous:
toth:

if (processingClient.StreetAddress != null
&& string.IsNullOrEmpty(processingClient.StreetAddress.Line1))
{
for (String month : months)
{
if (processingClient.StreetAddress.Line1 != null
&& processingClient.StreetAddress.Line1.Contains(month))
{
writeError(processingClient,
errorList,
"Street address line 1 is in date format ("
+ processingClient.StreetAddress.Line1 + ").");
}


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).

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).

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.

Re: October Road

2010-03-03 11:05 • by softwarebear (unregistered)
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 !

Re: October Road

2010-03-03 11:09 • by frits
300845 in reply to 300832
Quirkafleeg:
frits:
/*

string[] months =
{
"Jan", "Feb", "Mar",
"Apr", "May", "Jun",
"Jul", "Aug", "Sep",
"Oct", "Nov", "Dec"
[…]
*/
There. I fixed it.
Meta-comment. You win one tube-clogging Internet.


Steve Holt!

Re: October Road

2010-03-03 11:09 • by Quirkafleeg (unregistered)
300847 in reply to 300835
Rootbeer:
“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 .”

[…]
4. Metaphor nonsensical.
I don&rsqou;t think so. It&rsqou;s perfectly clear, not to mention obvious, that they should be painted purple.

Re: October Road

2010-03-03 11:13 • by kjordan (unregistered)
300848 in reply to 300838
Anonymous:
toth:

if (processingClient.StreetAddress != null
&& string.IsNullOrEmpty(processingClient.StreetAddress.Line1))
{
for (String month : months)
{
if (processingClient.StreetAddress.Line1 != null
&& processingClient.StreetAddress.Line1.Contains(month))
{
writeError(processingClient,
errorList,
"Street address line 1 is in date format ("
+ processingClient.StreetAddress.Line1 + ").");
}


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).

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).


Except it doesn't negate the check, so it'll never happen.
« PrevPage 1 | Page 2 | Page 3 | Page 4Next »

Add Comment