• Mr Bits (unregistered)

    Bonus points for simply returning an empty string instead of a meaningful error when the input doesn't map to an output.

    And at the bottom of the article, I see "View all 0 comments". Oh, the irony.

    Oh, and Frist BTW.

  • (nodebb) in reply to Mr Bits

    That's better than "View all 1 comments", which is what I see.

  • Torgo (unregistered)

    Dunno what you two are complaining about, "View all 2 comments" looked fine to me. You just need patience.

  • Torgo (unregistered)

    Dunno what you two are complaining about, "View all 2 comments" looked fine to me. You just need patience.

  • Torgo (unregistered)

    Oh good, I got my own TRWTF trying to comment, in which I got a "The CAPTCHA was not valid", so I resubmitted, but then it appears that both my comments are being held for moderation. Was it invalid or not?

  • (nodebb)

    Definitely done by an intern and never reviewed. This looks like code some of my 2nd or 3rd semester CS students might turn in.

  • Duke of New York (unregistered)

    My first assumption would be that the equals/hashCode contract on Deal is broken.

  • (nodebb)

    Maybe client.getSWMLs just returns all the SWMLs, and doesn't restrict it to the ones applicable to the list sent in. That would explain at least part of this code. There's no real excuse for iterating over the map though...

    My first assumption would be that the equals/hashCode contract on Deal is broken.

    "Doesn't understand Map" is a much more believable explanation. I'd only agree with you if I knew the code was written by a skilful and well-informed colleague, and then I would be surprised and upset that they hadn't included a comment to explain this unexpected and dangerous situation.

  • TheCPUWizard (unregistered)

    "There's no real excuse for iterating over the map though".... I love edge cases [may not apply to the article, but does apply to the comment I quoted.... Depending on many factors such as the size of a map (or other keyed collection) and the position in the internal ordered array of values, it may be faster to iterate than to search.....

  • Vera (unregistered) in reply to TheCPUWizard

    When you're getting to that point, chances are you'd be better off reassessing if a map is the best data structure for what you're trying to achieve.

  • (nodebb) in reply to TheCPUWizard

    it may be faster to iterate than to search

    That would take hard work to achieve. You'd have to make your own map implementation, and you'd have to write a truly insane lookup method inside it, such as randomly shuffling the map until the thing you want turns up at the front. In theory, someone might do that, but it's so much more work than just using one of the existing standard implementations (where lookup is faster than iterating) that it just wouldn't be something that you'd expect.

  • Gumpy Gus (unregistered) in reply to dkf
    Comment held for moderation.
  • JC (unregistered)
    Comment held for moderation.
  • Sara Minefield (unregistered) in reply to dkf

    Yes you are right. <a href="https://www.houstonjackets.com/product/for-the-culture-crystal-hoodie-charcoal-grey

  • Sara Minefield (unregistered) in reply to Vera
    Comment held for moderation.

Leave a comment on “A Voice Map”

Log In or post as a guest

Replying to comment #:

« Return to Article