Latest Entries »

Friday, March 26, 2010

Quality Code

No one writes perfect code. Programming is a process that takes a lot of planning, reviewing, and testing until an individual or team is satisfied that what they have produced is reasonably free of bugs and errors and works the way it should. However, despite our best efforts to produce quality code, customers will inevitably find ways to break it. They will find unexpected ways to use what we make, creating unexpected results.

The importance of writing good code depends on the type of system or program you are creating. For example, when programming a chess game, it is less important to eliminate bugs than when creating a program used to access someone’s bank account or deploy safety airbags in someone’s car. When we write code can cause financial problems, injury or even death, we better make sure that our code works reasonably well. This requires additional planning, revision and testing. Failure to do so can result in the loss of millions of dollars or even human lives.

Ultimately, the organization that sells the code should be responsible for its quality. If it is important that the product they sell be bug free, they should do additional testing to ensure quality. The only exception to this is when a programmer intentionally creates malicious code or leaves security flaws to later exploit the code for their own gain or to cause damage and harm. In such cases, both the organization and the programmer should be held responsible. Organizations should be responsible to hire good programmers, fire bad ones and create an environment in which quality is emphasized and good code is produced.

With that said, every programmer should take pride in their work and try to create as high-quality, bug-free code as possible. Additional planning in the design phase of a project and knowing your customer and how they will interact with what you are creating can help. Education, research, peer programming and using good programming techniques, data structures and algorithms will also lead to higher quality code. As always, the code produced should go through some sort of quality assurance, to make sure that it works reasonably well.

Making these extra efforts will not always guarantee that your code will be bug-free. It will however help it to perform better, have less bugs and cause less problems. Good code should be the goal of every programmer.

0 comments: