• SR (unregistered)

    The only relevant response is this: bottom fish banana.

  • (cs)

    *bangs head on desk

  • the beholder (unregistered)

    Comment line 1 is in date format

    ("Maybe I'm frist").

  • 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

  • Seminymous Coward (unregistered)

    My favorite part is the nonsensical "&& string.IsNullOrEmpty(processingClient.StreetAddress.Line1)" in the outer if.

  • 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?

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

  • (cs)

    Btw, what language is that? String, string and IsNullOrEmpty suggest C#, but the for (String month : months) is not C#-y. Anonymization gone wrong?

  • Nibh (unregistered)

    More validation is always better. We can't have our data jumpin' around all nimbly-bimbly from tree to tree...

  • Anon (unregistered)

    Hope there's no October Road in Scunthorpe.

  • Anonymous (unregistered)

    I wondered why I couldn't order anything off you guys.

    Regards

    Jane Doe 42 Juliet Place Marchwood

  • Anon (unregistered)

    Great stuff, there has to be a ton of street names that will run foul of this: Mayflower Juliet Mars

  • Anon (unregistered) in reply to Anonymous
    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.

  • Anon (unregistered) in reply to Anon
    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.

  • Seminymous Coward (unregistered) in reply to Bim Job
    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.

  • (cs) in reply to the beholder
    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)

  • PITA (unregistered) in reply to the beholder
    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.

  • Quirkafleeg (unregistered) in reply to Sad Bug Killer
    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.
  • Anonymous (unregistered) in reply to Sad Bug Killer
    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.
  • 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 ...

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

  • Augusto Novo from Decatur, IL (unregistered) in reply to Anonymous
    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 ...

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

  • PITA (unregistered) in reply to Bim Job
    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

  • (cs) in reply to Quirkafleeg
    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#.

  • (cs) in reply to Don Petrus
    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?

  • 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?!?

  • Bim Job (unregistered) in reply to Seminymous Coward
    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.

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

  • (cs)
    /*
    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.

  • (cs)

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

  • (cs) in reply to frits

    Couldn't it also be written in D ? (although this one hasn't been used a lot ^^)

  • Anonymous Coward (unregistered)

    Wow. Standing ovation. This one's an instant classic.

  • Anonymous (unregistered) in reply to Anonymous
    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.
  • (cs) in reply to toth
    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.

  • Quirkafleeg (unregistered) in reply to frits
    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.
  • (cs)
    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).

  • (cs)
    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...
  • (cs)

    “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.
  • Anon Ymous (unregistered) in reply to Bim Job
    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.

  • 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?

  • Anonymous (unregistered) in reply to toth
    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).

  • John (unregistered) in reply to PITA
    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"

  • kftt (unregistered) in reply to Matt Westwood
    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.

  • John (unregistered) in reply to John

    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.

  • Anonymous (unregistered) in reply to Anonymous
    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.

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

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

  • (cs) in reply to Quirkafleeg
    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!

  • Quirkafleeg (unregistered) in reply to Rootbeer
    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.

  • kjordan (unregistered) in reply to Anonymous
    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.

Leave a comment on “October Road”

Log In or post as a guest

Replying to comment #300825:

« Return to Article