Slashdot Mirror


Bad Programming Habits We Secretly Love (infoworld.com)

snydeq writes: Breaking the rules can bring a little thrill — and sometimes produce better, more efficient code. From the article: 'The rules are more often guidelines or stylistic suggestions, not hard-and-fast rules that must be obeyed or code death will follow. Sure, your code might be ridiculed, possibly even publicly, but the fact that you're bucking conventions adds a little bit of the thrill to subverting, even inadvertently, what amounts more often than not to the social mores of pleasant code. To make matters more complex, sometimes it's better to break the rules. (Shhhh!) The code comes out cleaner. It may even be faster and simpler.' What bad programming habits can't you (or won't you) break?

13 of 497 comments (clear)

  1. Documentation by PvtVoid · · Score: 5, Funny

    From TFA:

    my friend wired together an Eliza-like AI to his editor, and voilà, every function had a few lines of "documentation." The boss wasn't smart enough to understand that the lines meant nothing, so my friend was off the hook. His code was officially documented. I think he even got a promotion!

    He should have been shot.

  2. Re:"The code comes out cleaner"? by EllisDees · · Score: 5, Funny

    Does it trump the "make the code work" rule?

    --
    -- Give me ambiguity or give me something else!
  3. Re:You're the problem by Anonymous Coward · · Score: 4, Funny

    Back during Y2K updates to our code base, we'd occasionally have to deal with code written by an ex-employee, who we'll call John. It was so bad that every time someone opened a file he had worked on you'd hear a loud "FUCK! Another John file!" over the cubical walls.

  4. Re:"The code comes out cleaner"? by Mikkeles · · Score: 5, Funny

    Ah, the "No True Clean Code" fallacy.

    --
    Great minds think alike; fools seldom differ.
  5. Re:Lessons by internerdj · · Score: 5, Funny

    "Think of newspaper headlines when commenting. Don't make somebody read the whole article to know what the article is about." You_won_t_believe_the_three_things_this_method_does(), This_method_just_announced_it_was_running_for_the_GOP_presidential_nomination(unsigned int year), Five_ways_to_make_your_integers_long(), ...

  6. Re:"The code comes out cleaner"? by Anonymous Coward · · Score: 2, Funny

    I try to keep to 80 rows. A little harder to read, but worth it.


    PS: MOOO YOU COW!

  7. Re:All my indexes are i, j, k by default. by Anonymous Coward · · Score: 2, Funny

    It is actually a best practice. What I hate is seeing 'x' used for a discrete variable, or n for a float. Such people without regard for mathematical form should be shot.

  8. Re:You're the problem by Translation+Error · · Score: 4, Funny

    Any fool can see that.

    --
    When someone says, "Any fool can see ..." they're usually exactly right.
  9. Re:"The code comes out cleaner"? by Carewolf · · Score: 3, Funny

    1) Make the code work

    2) Make the code readable

    4) Make the code flexible.

    0) Make the code on time
    3) ???
    5) Make the code - PROFIT!

  10. Re:Bad Habits? by sconeu · · Score: 2, Funny

    I once saw source code for a library, written in Ada that had the following "feature".

    Since Ada code is "self documenting", each routine had a block comment documenting said routine. The block comment was LITERALLY a copy of the routine, commented out...

    e.g.:


    -- procedure body f is
    -- begin
    --TEXT_IO.PUT_STRING('Hello world');
    --TEXT_IO.PUT_LINE;
    -- end f;
    procedure body f is
    begin
    TEXT_IO.PUT_STRING('Hello world');
    TEXT_IO.PUT_LINE;
    end f;

    --
    General Relativity: Space-time tells matter where to go; Matter tells space-time what shape to be.
  11. Re:You're the problem by Spaham · · Score: 3, Funny

    yeah, Knuth is always your go to guy...

  12. Re:You're the problem by flargleblarg · · Score: 3, Funny

    “Hello, GOTO. My name is Inigo Montoya. You killed my father. Prepare to die.”

  13. Re:You're the problem by jandersen · · Score: 4, Funny

    ...who we'll call John...

    ...a contractor I'll call Paul

    Right, so who's going to come up with George and Ringo to make up the full set?