Wednesday, September 26, 2007

Commented out code...please use version control

I had to look through some code today to troubleshoot an issue. The code had tons of comments. You might say, wow that's a good thing right? Wrong, the comments were not comments about what the code was doing (or trying to do). Instead, the comments were commenting out old code dating back who knows how long. This makes the code so difficult to read and understand when the lines of old junk outnumbers the lines of code that is actually live and doing something.

There are so many great, free revision control systems available today (subversion, git, mercuial, bazaar), old code belongs in a revision control system and not in current code.

2 comments:

Anonymous said...

I think it is good practise to have the original vanilla code commented out in PeopleCode. On a compare report it is obvious what has changed for the original customisation.

Melora said...

This is great info to know.