Coding Vs Quality Coding

January 20, 2008

Most of the us (developers) think of writing just working code rather than writing good working code. Why do we do that ? Following could be some of the reasons in my view:

Lack of time:- Many times we face this. If a piece of code can be written in one day we get one hour to write the same code which leads to poor quality code. Everyone thinks its a great thing to write code that would take one day in one hour. After some time we will take two days to fix a small bug in the same piece of code. We won’t take this in to account. If the code could have been written well by taking one day, we could have fixed the same bug in one hour. Everyone wants to show early results rather than quality results.

Difference of Opinions:- If you have a different idea in implementing the code but your superior wants to implement in a different way, try to show him the disadvantages if we go with his approach and show advantages if we go with your approach.

Requirements:- Sometimes we write some stupid code to achieve a weird requirement. As we find no other option we go for it. Instead of this, if we can try to discuss about any alternatives with others we could do it better.

Rough and fair:- We continue to follow our school days where we use a rough book and a fair book! Every time, we tend to write rough code to test the functionality. We think that we can improve it after it works. But we won’t get back to make it fair. which leads to bad code.

Copy / Paste :- The most frequently used keys in the keyboard of a developer are ctrl+c and ctrl+v. We became so lazy that we use these keys even to copy a single alphabet. Because of this we repeat the same mistakes in multiple places of the project. Nowadays we have started spreading this to multiple projects. This leads to bad code. Instead of using ctrl+c and ctrl+v, If we can write the same code again or make it reusable code. We can improve a lot.

Standards:- Every one wants to follow their own standards. No one wants to follow common standards laid by some one. Some times we forget about making the standards before starting a project. If we keep follwing basic standards while we are coding that makes a big difference at the end.

Bug fixes:- Fixing a bug is like covering the defect by putting more lines of code. We don’t want to think for second time while writing those lines of code. We just want to reduce the bug count.

Blogged with Flock