Bad Code : A route to Critical Bugs !

“Are you new to the project? Is that you, fresh team member to an existing project?”

You started to work on a fresh project and you see a bad piece of code somewhere. Then you say who on earth has written that piece of crap. You extend it saying “nah, that’s someone else’s code, I’m not doing anything about it”, “I don’t have time to fix that – I have other tasks”, “I’ll surely screw up the existing functionalities”.

The problem is – bad code accumulates. Even if the piece is a small one, it adds up over time and soon enough you have that “big legacy project that was written by some incompetent guys and no one wants to support”. Someone once said that in six months all projects are “legacy”, because they have a lot of accumulated bad code. Or in other words we can relate it as technical debt.

The best approach should be fixing it as soon as possible. When you see some piece of crap or something that’s not exactly a great practice – fix that there and then, Or it will be too late, because then other code will start depending on that, and new code will follow the same practice (sometimes with copy/paste), and fixing it will be a nightmare. Let’s address the wrong statements above:

Code reviews are also important in regard to this problem. If all code that gets committed is code-reviewed, then bad piece of code will start vanish from the project. It may still occur, but very rarely.

So I’ll advice you – fix that code immediately. It saves time and headaches, and makes you a bit more proud of the project, rather than stating “that’s some piece of crap that some incompetent folks has written and I was just doing some tasks on the side”. Because you can’t say that – if the project is crap, it’s your fault as well.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s