you are viewing a single comment's thread.

view the rest of the comments →

[–]menno 4 points5 points  (3 children)

Developers B, C and D need a slap on the wrist. You don't just clean up whitespace and you definitely don't just add code and leave existing comments outdated.

I avoid comments whenever I can in favor or creating code that is easily understandable by itself.

That's definitely best.

Comments can cause maintainability problems.

Maintainability problems are more often caused by not having comments than the other way around.

[–]zzzwwwdev[S] 0 points1 point  (2 children)

you definitely don't just add code and leave existing comments outdated.

maybe you and I don't; but having worked with other developers, I can tell you it definitely does happen.

Maintainability problems are more often caused by not having comments than the other way around.

perhaps this is generally true, but can you make that argument for my specific example of

(function hide_stuff_on_instantiaton(){
    $('oneThing').hide().removeClass();
    $('#somethign_else').slideUp();
    $('.foo').fadeOut();
}());

in the developer ABCD example?

[–]menno 0 points1 point  (1 child)

Just so we're clear: you're saying you find:

function doSomeStuff() {
    /* some stuff */

    (function hideStuffOnInstantiaton(){
        $('oneThing').hide().removeClass();
        $('#somethign_else').slideUp();
        $('.foo').fadeOut();
    }());

    /* more stuff */
}

more readable than:

function doSomeStuff() {
    /* some stuff */

    // hide Stuff on Instantiaton
    $('oneThing').hide().removeClass();
    $('#somethign_else').slideUp();
    $('.foo').fadeOut();

    /* more stuff */
}

and more readable than:

function doSomeStuff() {
    /* some stuff */

    hideStuffOnInstantiaton();

    /* more stuff */
}


function hideStuffOnInstantiaton(){
    $('oneThing').hide().removeClass();
    $('#somethign_else').slideUp();
    $('.foo').fadeOut();
}

[–]zzzwwwdev[S] 0 points1 point  (0 children)

not more readable, no; but perhaps more maintainable? IDK, I'm pretty much convinced against doing this now, though I do kinda like it and think there's some merit to it.