• (cs) in reply to chubertdev
    chubertdev:
    QJo:
    Best commit message I saw was along the lines of: "This is too technically difficult for maintenance staff to understand, so take it as read that this checkin is important and necessary."
    
    	 /*
    	 * You are not expected to understand this.
    	 */
    

    But, if you DO want an explanation, the Lyons book does a pretty adequate job of doing it.

  • (cs) in reply to Fred
    Fred:
    chubertdev:
    $m = 'LLLLSSSSSSSSLLLLLLLL';

    Sign #1 that code should be replaced immediately.

    s/code/coder/

    In my experience, coders that create this type of code never stay in one place for too long, so they're usually gone when the code is discovered. I've seen this is plenty of code, but only code that I've inherited and haven't met the coder.

  • (cs) in reply to chubertdev
    chubertdev:
    Fred:
    chubertdev:
    $m = 'LLLLSSSSSSSSLLLLLLLL';

    Sign #1 that code should be replaced immediately.

    s/code/coder/

    In my experience, coders that create this type of code never stay in one place for too long, so they're usually gone when the code is discovered. I've seen this is plenty of code, but only code that I've inherited and haven't met the coder.

    In most cases this is true. If there IS a reason for such code, it is incumbent on the coder to offer an explanation in the comments, preferably verbose, to assist others (and most likely the original coder) in understanding the code.

    So, if someone says "I had my reasons.", the response should be "And they are?".

    In my years of programming, writing lucid comments is something that should be encouraged. Maybe a good metric for a programming job should be "words of comments". Unfortunately this can be "cur and paste" abused, but if you can read them, comments can give a vital understanding to the original authors state of mind.

  • (cs)
    // they took my stapler, I'm going to burn the place down
    if ($m == '') $m = 'LLLLSSSSSSSSLLLLLLLL'; 
    
  • (cs)

    "I Had My Reasons" isn't very helpful, but it seems apparent that this guy was originally coding to some obscure requirement that the replacement implementation doesn't conform to.

    The fact that there's no record anywhere else of why that feature existed, is evidence of problems that go way farther than just that one guy.

  • (cs)

    Let me guess: the string specifies how the results should be laid out on screen. One row of four "Large" entries (or maybe two rows, if there are only two items per row), followed by one row of eight "Small" entries, followed by two other Large rows. The dataset comes ordered by size from the database, and the loop basically picks from the end of the resultset for the large slots and the beginning for the small slots.

  • (cs) in reply to herby
    herby:
    If there IS a reason for such code, it is incumbent on the coder to offer an explanation in the comments, preferably verbose, to assist others (and most likely the original coder) in understanding the code.

    So, if someone says "I had my reasons.", the response should be "And they are?".

    There's usually just one reason behind that comment, and it goes something like "I did it in accordance to telepathic instructions from the mothership."

  • tristique (unregistered) in reply to Nagesh
    Nagesh:
    Developer Dude:
    In one interview some years back, the head of engineering mentioned that the lead architect found Spring too complicated, he couldn't understand it, so instead he wrote his own DI framework.

    Luckily they didn't offer me the job - I dodged the bullet there.

    On another hand, our CMM 6 certified company extended Spring by downloading source code. That is real clever engineering.

    If you extended Spring, does that mean you shortened Summer? Hey wait a minute, I didn't think India even had Spring -- I thought there is just Wet Season and Dry Season.

  • Keith (unregistered) in reply to Trevor

    Once PHP is processed into bytecode, there are no variable names... and you do cache your bytecode, right? Same with most compiled languages; as an added bonus, when you strip the symbols from your production binaries you can fit a lot more binary in the same ROM space.

  • (cs)

    Eric: "Look, I have my reasons." Kitty: [agitated] "What could they be? What could they possibly be?"

  • (cs) in reply to tristique
    tristique:
    Nagesh:
    Developer Dude:
    In one interview some years back, the head of engineering mentioned that the lead architect found Spring too complicated, he couldn't understand it, so instead he wrote his own DI framework.

    Luckily they didn't offer me the job - I dodged the bullet there.

    On another hand, our CMM 6 certified company extended Spring by downloading source code. That is real clever engineering.

    If you extended Spring, does that mean you shortened Summer? Hey wait a minute, I didn't think India even had Spring -- I thought there is just Wet Season and Dry Season.

    import cyclones from Bangladesh
  • Cheong (unregistered) in reply to DQ
    DQ:
    Next week we get a story about how an entire system collapsed because the results weren't in the expected order...
    Agreed the system is likely to be in trouble but maybe not system collapse.

    Actually I've seen people doing less cryptic version of this so the autosort function of grid works as what the user expected. (Hint: Some grid does not support multiple sort fields)

    Yes, there could be a reason, even if the coder refuse to tell you.

  • John (unregistered) in reply to Slapout
    Slapout:
    QJo:
    Presumably you had your reasons for not specifying it, but 2,000,000+ what?

    That's two million plus signs.

    So it is written in Brainfuck then.

  • faoileag (unregistered) in reply to vt_mruhlin
    vt_mruhlin:
    "I Had My Reasons" isn't very helpful, but it seems apparent that this guy was originally coding to some obscure requirement that the replacement implementation doesn't conform to.

    The fact that there's no record anywhere else of why that feature existed, is evidence of problems that go way farther than just that one guy.

    No, that would be a valid explanation if the phrase had been "There were reasons for this" which implies that the strange code made sense at the time, but that the reasons why the code made sense at the time have long since been forgotten.

    "I Had My Reasons" on the other hand is just another way of saying "I know this is crap but I can't think of a good enough excuse to save face".

  • Sebastian Ramadan (unregistered) in reply to Keith

    Sure... but PHP still sucks.

  • EatenByAGrue (unregistered) in reply to QJo
    QJo:
    Oh, and a cheap shot but I can't resist:

    "... the 10K+ LOC invoice manger file, ..."

    Has it got a newborn messiah in it?

    To quote Terry Jones, there's a mess all right, but no messiah!

    CAPTCHA: genitus, as in "Dominus filius unigenitus". Seems quite appropriate.

  • (cs) in reply to tristique
    tristique:
    Nagesh:
    Developer Dude:
    In one interview some years back, the head of engineering mentioned that the lead architect found Spring too complicated, he couldn't understand it, so instead he wrote his own DI framework.

    Luckily they didn't offer me the job - I dodged the bullet there.

    On another hand, our CMM 6 certified company extended Spring by downloading source code. That is real clever engineering.

    If you extended Spring, does that mean you shortened Summer? Hey wait a minute, I didn't think India even had Spring -- I thought there is just Wet Season and Dry Season.

    Wet season and dry season is in Mumbai only, you idiot! Read up on India. I am in Hyderabad. We download source code of the Spring framework and extend it.

  • Friedrice The Great (unregistered) in reply to da Doctah
    da Doctah:
    herby:
    If there IS a reason for such code, it is incumbent on the coder to offer an explanation in the comments, preferably verbose, to assist others (and most likely the original coder) in understanding the code.

    So, if someone says "I had my reasons.", the response should be "And they are?".

    There's usually just one reason behind that comment, and it goes something like "I did it in accordance to telepathic instructions from the mothership."
    I get mine via Bluetooth connection to my featurephone that gets it via the internet from the NSA. They said they'd give me free Internet if I signed up with them.

  • Newbie (unregistered)

    I'm not very familiar with PHP. Does the replacement code really do exactly the same thing as the original code in one line as opposed to 20, or is the disagreement simply about whether or not the query result should be re-ordered before being displayed?

  • Cheong (unregistered) in reply to Newbie

    Actually I think the story is like this:

    The web uses order number in 4 digit "vendor/location code" + yyyyMMdd + sequence number format. There is a grid that will display orders, possibly don't have datetime in the columns if that's considered "detail".

    Some random users said they prefer to display things ordered by date, so the "order number" appeared as handy choice and the coder write some code to swap the date part to the front. Case closed.

    Then some years later the coder is fired because he care not to explain this, and the grid now returns to the original sorting order.

    Nothing critical to the users, just visible.

  • (cs) in reply to QJo

    I read LOC as Libraries of Congress. Maybe it's not as bad as I assumed.

  • i❦ssl (unregistered) in reply to omnichad
    omnichad:
    I read LOC as Libraries of Congress. Maybe it's not as bad as I assumed.
    With a third party library for Sen. Lieberman.
  • (cs) in reply to i❦ssl
    i❦ssl:
    omnichad:
    I read LOC as Libraries of Congress. Maybe it's not as bad as I assumed.
    With a third party library for Sen. Lieberman.

    Don't forget Nathan Fletcher, too!

  • airdrummer (unregistered) in reply to snoofle

    "I've been using Word "

Leave a comment on “I Had My Reasons”

Log In or post as a guest

Replying to comment #:

« Return to Article