1. 3
  1.  

  2. 6

    If you’re writing a bit of code that duplicates the functionality of something that’s already there, pull out the old version when the new one is done. Just delete it. You can get it back, I promise. That’s what Git is for.

    This. I’ve seen to many commented out blocks of source code that were never uncommented. It makes things scary for the future maintainer, was this supposed to be used at some point, or should it be gone for ever?

    1. 4

      The largest problem with things that are removed from your file is it’s no longer greppable.

      Git history is something where you have to already know what you’re looking for exists before you go looking around in it.

      I’m not saying I like huge swaths of commented-out code either (so when do you delete it?) but let’s not act like there are no advantages.

      1. 2

        Ah, that’s true. Most of the commented code I’ve seen though doesn’t really benefit from being greppable.

        1. 2

          This is where tools like Atlassian’s Fisheye can come in handy.

          Why Github doesn’t add this to their product is beyond me.

    2. 1

      Lots of great advice in this article. I especially like the emphasis on providing business value. You can craft the most brilliant perfect pearl ever to exist and still have your company go belly up because people lost sight of the bottom line.