Saturday, March 6, 2010

Attaining Code Quality Excellence !

Software quality has two primary dimensions: Internal Quality and External Quality. External Quality is an attribute that relates the end-user experience. External Quality can be assessed and improved through defect prevention as well as black box testing.

Internal Quality is visible to various groups in the development team such as designers, developers, maintainers and technical reviewers. Internal Quality is invisible to the end-users. Internal Quality can be improved by means of defect prevention as well as defect detection followed by analysis and correction or defect fixing. Software inspection and reviews are the means to assess, control and assure Internal Quality. Although software inspection and reviews have operational differences, both are aligned towards the objective of examining work products to unearth defects.

Great focus on black box testing by means of well-documented test cases, multiple rounds of rigorous testing, defect fixing and defect verification is mandatory for successful deliveries. However, lack of focus on Internal Quality could pose serious consequences in the form of unexpected naive defects, technical issues and maintenance nightmares. Poor Internal Quality encompasses the root causes for issues related to External Quality. Thus, in order to improve Software Quality, Internal Quality must be improved.

I could identify seven critical milestones that are necessary to attain Code Quality Excellence through experiential learning and a list of five best practices that were useful in ensuring good coding practices and assurance of Internal Quality.    My second paper on Code Quality ("Critical Milestones and Best Practices for Code Quality Excellence") provides a comprehensive coverage of these milestones and best practices.

As I wrote in my previous blog, Code Quality continues to be an unfading focus area in Software Engineering!   Any thoughts?

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!