• Pete (unregistered)

    As Terry Pratchett wrote: Real stupidity beats artificial intelligence every time.

  • Henning (unregistered)

    Or it was just a bad merge in VCS?

  • Industrial Automation Engineer (unregistered)

    What wrong with the line containing

    /*

    ?

  • (nodebb)

    I want to leave a comment but cannot decide which one of the contradicting messages I should address.

  • Andy Miller (unregistered)

    Lines 1, 3, 5, 6 and 8 are all fine. Only 2, 4 and 7 contain problems. By LoC, that's over 50% OK.....

  • pudin9 (unregistered)

    Note that the only line containing actual logic is a contradiction by itself too.

  • (nodebb)

    between the comment and the one line of executable code, not a single thing agrees with anything else.

    So you think that it's reasonable / correct / agreeing for a variable called _price to contain a value of type OrderValidator???

    For shame, Remy, for shame.

  • (author) in reply to Steve_The_Cynic

    I feel like you're doing a bit that I'm too dumb to get.

  • Anonymous') OR 1=1; DROP TABLE wtf; -- (unregistered) in reply to Industrial Automation Engineer

    What wrong with the line containing

    /*

    Aside from the fact that the original line was /** and not /*, it's not lined up properly. The asterisks on the following lines should line up with the first * from the /*``, not the/`.

    /**
     * This is a correctly aligned block comment
     */
    
    /**
    * This is wrong
    */
    
  • 516052 (unregistered)

    Are leading * required in PHP comments? It wouldn't surprise me if that was the case given how bad the language is othervise. It'd make sense they'd have adopted that sort of formating stupidity as well.

  • MatTheCat (unregistered)

    I’ve seen this countless times. Developers were hammered with “comments are good” so they don’t care if they are useless and/or wrong. The worse is I always failed to make them realize.

  • my name is missing (unregistered)

    I worked with someone once who always copy pasted code from somewhere else in the app. TO make it worse they generally copied more lines than necessary adding new functionality that did nothing but made things more confusing. I always wondered if the programmer was trying to evolve the code somehow.

  • The Shadow Knows (unregistered)

    I've known companies where the policy was never to remove comments - you could take out or change code, but anything that was a comment needed to stay.

  • The Shadow Knows (unregistered) in reply to my name is missing

    And they copied the comments along with the code, then changed the code because they wanted the logic rather than the variables, and left the comments untouched.

  • Namaste (unregistered)

    Product Statuses, Warehouse Suppliers, Prices, Order Validators, .... you.... me..... all these things are connected in the Universe. Let us close our visual eyes and open our mind's eye as we focus on this code to achieve ultimate enlightenment...

  • Prime Mover (unregistered)

    [code] There was an old man from Tralee Who was stung on the neck by a wasp When asked if it hurt He replied, "Not a bit It can do it again if it likes." {/code]

  • Prime Mover (unregistered)

    Take 2:

    There was an old man from Tralee
    Who was stung on the neck by a wasp
       When asked if it hurt
       He replied, "Not a bit
    It can do it again if it likes."
    
  • Brian Boorman (unregistered) in reply to Anonymous') OR 1=1; DROP TABLE wtf; --

    That's not wrong. That's just style.

  • JB (unregistered)

    This might be the worst code ever posted on this site.

  • King (unregistered)

    I especially like the placing of the curly brackets. The programmer has clearly studied McConnells "Code Complete 2".

  • ooOOooGa (unregistered) in reply to 516052

    Are leading * required in PHP comments?

    No.

  • ooOOooGa (unregistered) in reply to MatTheCat

    I’ve seen this countless times. Developers were hammered with “comments are good” so they don’t care if they are useless and/or wrong.

    I've also seen 'comments are bad. They are always redundant with the code and don't add any value. It is just more work to maintain both the code and the comments.'

    That type of thinking isn't any better. It just leads to coding by tribal knowledge that gets lost as fast as employee turnover happens.

  • Chris (unregistered)

    Looks like they weren't confident with how to create the Warehouse Supplier class, or thought this was a good shortcut, and so copied over everything from the Product Status class. Or worse, they derived the Warehouse Supplier from Product Status.

    The Warehouse Supplier needs an OrderValidator to determine if orders can be met, so they shoved one into the "price" variable, instead of creating its own variable. Probably means there's a bunch of junk variables in there left over from the copy-paste. They also updated the name for the type being returned, but not the rest of the comment.

    And they probably thought this was a job well done.

  • 516052 (unregistered)

    I newer understood why people find proper commenting so difficult. I mean, it's just common sense that should be plainly obvious to anyone who has ever written a paper.

    Your code is the text. It's the body of what you are writing. The comments are your footnotes. If the text can't adequately explain everything but the explanation does not belong in the body of your writing you add a footnote. Equally if the code can not explain it self you add a comment.

    It's not difficult.

  • (nodebb)

    $this->_price = new OrderValidator(); doesn't contradict any of the other lines. It's perfectly feasible that a warehouse supplier or a product status might have a price attribute. It does, however, contradict itself, given that a price is probably an amount of money to be paid and an order validator is probably a thing for validating orders.

  • Prime Mover (unregistered) in reply to 516052

    People go into the career of computer program for the same reason mathematicians choose their own careers.

    It's because they have absolutely no interest in communicating anything useful to the outside world.

    It's the old "I did maths because I can't write essays." And indeed, "I write programs because I can't write comments."

  • 516052 (unregistered) in reply to Prime Mover

    I said paper, not essay. Essays are creative works, something that you may or may not be able to do. Papers are rigidly structured articles with footnotes and refrences and stuff. I can understand someone from our profession not being very communiciative but any educational institution worth the price of tuition is going to force you to write enough papers to at least acquaint you with the basics of how its done.

    And even if not, as part of our job you should be reading papers in order to keep up with new standards, conventions and programming languages and other stuff that comes out and just general new developments in our field. So you should get a feel for that from those.

    Hell, even most tutorials that aren't video are structured in a way that you can refrence them for how to do this.

  • RLB (unregistered) in reply to Prime Mover

    People go into the career of computer program for the same reason mathematicians choose their own careers. It's because they have absolutely no interest in communicating anything useful to the outside world. Nonsense. I became a computer programmer because I loved what I could make my Speccy do and I wanted to share that with the outside world. Computers are one of the greatest communication tools we have.

  • RLB (unregistered) in reply to Prime Mover

    People go into the career of computer program for the same reason mathematicians choose their own careers. It's because they have absolutely no interest in communicating anything useful to the outside world.

    Nonsense. I became a computer programmer because I loved what I could make my Speccy do and I wanted to share that with the outside world. Computers are one of the greatest communication tools we have.

  • Victor (unregistered)

    Strong contender for making it to the best of.

Leave a comment on “Not to Contradict You…”

Log In or post as a guest

Replying to comment #531641:

« Return to Article