Saturday, March 6, 2010

On Code Quality

Code Quality has been an unfading focus area in Software Engineering.  Software inspection and reviews have been in practice in the industry for over three decades.  Reviews uncover errors while they are relatively inexpensive to find and correct.

In any project, code reviews need to provide a complete coverage of the entire code base for better results. Code reviews need to focus on adherence to various factors such as

a) Content Quality:   Adherence to requirements, architecture, design, coding standards, programming principles and coding style
b) Format Quality:   Readability in terms of adequate internal comments, indentation, structure
c) Business Quality:   Alignment with business goals in terms of extensibility, maintainability, and so on.

Implementing rigorous reviews has always been a challenge in the industry due to time-to-market and budget constraints.

Roger S Pressman uses the term ‘Formal Technical Reviews’ (FTR) to denote work product inspections, reviews and walk-throughs. The motivation of all kinds of FTRs are the same – ‘ To have a work product examined by an external group of professionals so that they can unearth as many defects as possible at early stages of software life cycle.’

One of the great breakthroughs in software engineering was Gerald Weinberg’s concept of egoless programming – the idea that no matter how smart a programmer is reviews will be beneficial. Reviews and Inspections are considered to be one of the 10 best influences on Software Engineering. Defect prevention at early stages is invaluable as it enhances software quality. Code review automation saves human intervention in detecting issues related to the static nature of the code. Defect prevention and code review automation make manual reviews more effective. Refactoring is a valuable practice to improve code quality to improve the design.

Systematic Focus on Code Quality(SFCQ) is a technique to improve Code Quality and Design. It is technology independent. Besides, it is suitable for projects that follow either waterfall or iterative life cycles.

It ensures
• Improvement in code quality & hence customer satisfaction
• Constructive feedbacks and improvements in software design
• Enhanced maintainability
• Professional development in design and coding skills
• Improvement in team morale & esteem

The guiding principles of this technique are
• Increasing developers’ accountability in producing good quality code
• Improving productivity by deploying tools for code reviews
• Leveraging expertise in manual reviews to improve code quality
• Refactoring instead of reworking to make the development process more challenging

I presented my first paper on this subject during 2004.  (Raja Bavani, Systematic Focus on Code Quality: A Technique to improve Design and Implementation, 5th Annual International Software Testing Conference in India 2005).  Several practitioners have tried this approach and found positive results.  Just thought of sharing this on this blog!

No comments: