Slashdot Mirror


What Are the Unwritten Rules of Deleting Code?

Press2ToContinue writes "I came across this page that asks the question, 'what are the unwritten rules of deleting code?' It made me realize that I have seen no references to generally-accepted best-practice documents regarding code modification, deletion, or rewrites. I would imagine Slashdot's have come across them if they exist. The answers may be somewhat language-dependent, but what best practices do Slashdot's use when they modify production code?"

8 of 384 comments (clear)

  1. Vigil by Anonymous Coward · · Score: 4, Funny

    Let Vigil delete your code for you when it's wrong and must be punished.

  2. My rules for deleting code by EuclideanSilence · · Score: 5, Funny

    Ok so you are working on a team and deleting code. Here are some basic rules to follow.
    1) Don't delete your boss's code. Just change all the function calls to go around it. If he asks you about it, say that someone else changed it.
    2) Don't cuss out the guy who's code you are deleting until after you are done. You might have to ask him why he did certain things (unexpected library behavior etc).
    3) Make sure the code you add to replace the old code is longer than what you deleted. That way, you can tell your boss that you added 'x' lines of code to the project.
    4) Don't waste time unit testing your new code. Obviously if you have to replace the old code, then you are a better programmer than the last one. If the last programmer's code passed unit tests, and you are better, then obviously yours would pass unit tests too.
    Any politeness the other programmer shows to you after you delete his code is not to be trusted. The code we write is pride to us, and deleting someone else's code is like seeing your coworkers girlfriend naked in the shower. Sure, it's not really your fault and you didn't really do anything bad. But expect some negative passive aggressive behavior in response.

  3. There used to be rules ... by inglorion_on_the_net · · Score: 5, Funny

    There used to be written rules for deleting code. Then someone deleted them. And since we don't use version control, we have no way to get them back.

    --
    Please correct me if I got my facts wrong.
  4. This comment has been deleted ... by ElRabbit · · Score: 5, Funny

    ... for clarity

  5. I have a great idea by Chrisq · · Score: 4, Funny

    The more you can delete, the better.

    Starting from the Murphy's law on programming: Every non trivial program has at least one bug

    You can derive by rigorous analogy the Murphy's law on not-programming: Every non written code has exactly zero bugs

    I have it - the holy grail, the key to bug free coding. If the deleted code has no bugs just restore the deleted lines and delete the rest. You will then have bug free programs.

  6. Re:That's what I do too, by iapetus · · Score: 5, Funny

    Unfortunately bitter experience prevents me from being too nasty on this one, because too many times I've been through the process of having good test policies in place, followed by senior management decreeing that in order to meet deadlines, testing and documentation will have to fall by the wayside 'just for a few weeks'. I know it would count as justifiable homicide, but I still can't afford the court time. ;)

    --
    ++ Say to Elrond "Hello.".
    Elrond says "No.". Elrond gives you some lunch.
  7. Re:How can ... by Anonymous Coward · · Score: 0, Funny

    i never delete code even with version control, i just comment it out so that others can easily see what i removed with a comment as to why.

  8. Re:How can ... by swillden · · Score: 4, Funny

    You can switch branches in SVN just fine.

    And as a bonus you'll have time to go get a cup of coffee!

    --
    Note to ACs: I usually delete AC replies without reading them. If you want to talk to me, log in.