Sunday, February 14, 2010

Dead Code

We all love our code. So, we usually don't delete our code even if it is not referred anywhere in the system. Sometimes we comment the unused code. May be we will need that soon. All these are dead codes. Because these codes are never used and in most cases it will never be used. To manage the history of our code there are some other tool available. Source Control can archive all our code. Why do we need to keep the dead code in the working code? We can find any version of our code in the source control.

If a system have some dead code then there is a chance of spending time and effort while refactoring some production code. You might have to re-factor in dead code because compiler would complain in the dead code because of your refactoring. It becomes worst if you fail to identify the code is a dead code or not.

So, delete your dead code even if you spend big effort and created a beautiful logic. Don't hesitate. You may come-up with a better idea if you solve the same problem again. If you feel that the you might need the code in future then add a label in your source control. But delete the dead code.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home