Inspections are not Optional
Join the DZone community and get the full member experience.Join For Free
every developer is aware that code inspections are possible, some might have experienced the usefulness of code inspections, however, the fact is that
inspections are not optional
without inspections your defect removal rate will stall out at 85% of defects removed; with inspections defect removal rates of 97% have been achieved.
code inspections are only the most talked about type of inspection; the reality is that all artifacts from all phases of development should be inspected prior to being used. inspections are necessary because software is intangible and it is not once everything is coded that you want to notice problems.
in software, we tend to code up an entire set of functionality, demonstrate it, and then find out that we have built the wrong thing! if you are working in a domain with many requirements then this is inevitable, however, many times we can find problems through inspection before we create the wrong solutions let's look at some physical examples and then discuss their software equivalents.
requirement defectsthe requirements in software design are equivalent to the blueprints that are given to a contractor. the requirements specify the system to be built, however, if those requirements are not inspected then you can end up with the following:
|balcony no door||missing landing||chimney covering window|
|stairs displaced||stairs to ceiling||door no balcony|
all of the above pictures represent physical engineering failures. every one of these disasters could have been identified in the blueprints if a simple inspection had been done. clearly it must have become clear to the developers that the building features specified by the requirements were incompatible, but they completed the solution anyways.
balcony no doorthis design flaws can be caused by changing requirements ; here there is a balcony feature that has no access to it. in balcony no door it is possible that someone noticed that there was sufficient room for a balcony on the lower floor and put it into one set of plans. the problem was that the developers that install the sliding doors did not have their plans updated.
here the changed requirement did not lead to an inspection to see if there was an inconsistency introduced by the change.
door no balconyin door no balcony something similar probably happened, however, notice that the two issues are not symmetric . in balcony no door represents a feature that is inaccessible because no access was created, i.e. the missing sliding door.
in door no balcony we have a feature that is accessible but dangerous if used. in this case a requirements inspection should have turned up the half implemented feature and either: 1) the door should have been removed from the requirements, or 2) a balcony should have been added.
missing landingthe missing landing occurs because the requirements show a need for stairs, but does not occur to the architect that there is a missing landing. looking at a set of blueprints gives you a two dimensional view of the plan and clearly they drew in the stairs. to make the stairs usable requires a landing so that changing direction is simple. this represents a missing requirement that causes another feature to be only partially usable .
this problem should have been caught by the architect when the blueprint was drawn up. however, barring the architect locating the issue a simple checklist and inspection of the plans would have turned up the problem.
stairs to ceilingthe staircase goes up to a ceiling and therefore is a useless feature . not only is the feature incomplete because it does not give access to the next level but also they developers wasted time and effort in building the staircase.
if this problem had been caught in the requirements stage as an inconsistency then either the staircase could have been removed or an access created to the next floor. the net effect is that construction starts and the developers find the inconsistency when it is too late.
at a minimum the developers should have noticed that the stairway did not serve any purpose and not build the staircase which was a waste of time and materials.
stairs displacedhere we have a clear case of changed requirements. the stairs were supposed to be centered under the door, in all likelihood plans changed the location of the door and did not move the dependent feature.
when the blueprint was updated to move the door the designer should have looked to see if there was any other dependent feature that would be impacted by the change.
architectural defectsarchitectural defects come from not understanding the requirements or the environment that you are working with. in software, you need to understand the non-functional requirements behind the functional requirements -- the ilities of the project (availability, scalability, reliability, customizability, stability, etc). architectural features are structural and connective. in a building the internal structure must be strong enough to support the building, i.e. foundation and load bearing walls.
|insufficient foundation||insufficient structure||connectivity problem|
insufficient foundationhere the building was built correctly, however, the architect did not check the environment to see if the foundation would be sufficient for the building. the building is identical to the building behind it, so odds are they just duplicated the plan without checking the ground structure.
the equivalent in software is to design for an environment that can not support the functionality that you have designed. even if that functionality is perfect, if the environment doesn't support it you will not succeed.
insufficient structurehere the environment is sufficient to hold up the building, however, the architect did not design enough structural strength in the building. the equivalent in software design is to choose architectural components that will not handle the load demanded by the system.
for example, distributed object technologies such as corba, ejb, and dcom provided a way to make objects available remotely, however, the resulting architectures did not scale well under load.
connectivity problemhere a calculation error was made when the two sides of the bridge were started. when development got to the center they discovered that one side was off and you have an ugly problem joining the two sides.
the equivalent for this problem is when technologies don't quite line up and require awkward and ugly techniques to join different philosophical approaches. in software, a classic problem is mapping object-oriented structures into relational databases. the philosophical mismatch accounts for large amounts of code to translate from one scheme into the other.
coding defectscoding defects are better understood (or at least yelled about :-), so i won't spend too much time on them. classic coding defects include:
- uninitialized data
- uncaught exceptions
- memory leaks
- buffer overruns
- not freeing up resources
- concurrency violations
- insufficient pathways, i.e. 5 conditions but only 4 coded pathway
testing defectstesting defects occur when the test plan flags a defect that is a phantom problem or a false positive. this often occurs when requirements are poorly documented and/or poorly understood and qa perceives a defect when there is none.
false positives slow down development.
the reverse also happens where requirements are not documented and qa does not perceive a defect, i.e. false negative.
false negatives can slip through to your customers...
both false positives and negatives can be caught by inspecting the requirements and comparing them with the test cases.
root cause of firefightingwhen inspections are not done in all phases of software development there will be fire-fighting in the project in the zone of chaos .
most software organizations only record and test for defects during the testing phase.
unfortunately, at this point you will detect defects in all previous phases at this point.
qa has a tendency to assume that all defects are coding defects -- however, the analysis of 18,000+ projects does not confirm this. in the economics of software quality , capers jones and olivier bonsignour show that defects fall into different categories. below we give the category, the frequency of the defect, and the business role that will address the defect.
|defect role category||frequency||role|
|requirements defect||9.58%||ba /product management|
|architecture or design defect||14.58%||architect|
|testing defect||15.42%||quality assurance|
|documentation defect||6.25%||technical writer|
note, only the bolded rows above are assigned to developers.
notice that fully 25% of the defects (requirements, architecture) occur before coding even starts. these defects are just like the physical defects shown above and only manifest themselves once the code needs to be written.
also, only about 54% of defects are actually resolvable by developers, so by assigning all defects to the developers you will waste time 46% of the time when you discover that the developer can not resolve the issue.
fire-fighting is basically when there need to be dozens of meetings that pull together large numbers of people on the team to sort out inconsistencies. these inconsistencies will lie dormant because there are no inspections.
of course, when all the issues come out, there are so many issues from all the phases of development that it is difficult to sort out the problem!
learn how to augment your bug tracker to help you to understand where your defects are coming from in bug tracker hell and how to get out!
solutionsthere are two basic solutions to reducing defects:
- inspect all artifacts
- shorten your development cycle
in the economics of software quality the statistics show that defect removal is not effective in most organizations. in fact, on large projects the test coverage will drop below 80% and the defect removal efficiency is rarely above 85%. so even if you are using agile development you will still not achieving a high level of defect removal and will be limited in the software quality that you can deliver.
agile development can reduce fire-fighting but does not address defect removal
inspect all artifactsorganizations that have formal inspections of all artifacts have achieved defect removal efficiencies of 97%! if you are intent on delivering high quality software then inspections are not optional . of course, inspections are only possible for phases in which you have actual artifacts. here are the artifacts that may be associated with each phase of development:
|requirements||use case, user story, uml diagrams (activity, use case)|
|architecture or design||uml diagrams (class, interaction, deployment)|
|coding||uml diagrams (class, interaction, state), source code|
|testing||test plans and cases|
|database||entity-relationship diagrams, stored procedures|
effective inspectionsinspections are only effective when the review process involves people who know what they are looking for and are accountable for the result of the inspection. people must be trained to understand what they are looking for and effective check lists need to be developed for each artifact type that you review, e.g. use case inspections will be different than source code reviews.
inspections must have teeth otherwise they are a waste of time. for example, one way to put accountability into the process is to have someone other than the author be accountable for any problems found. there are numerous resources available if you decide that you wish to do inspections.
conclusionthe statistics overwhelming suggest that inspections will not only remove defects from a software system but also prevent defects from getting in. with inspections software defect removal rates can achieve 97% and without inspections you are lucky to get to 85%.
since ibm investigated the issue in 1973, it is interesting to note that teams trained in performing inspections eventually learn how to prevent injecting defects into the software system. reduced injection of defects into a system reduces the amount of time spent in fire-fighting and in qa.
you can only inspect artifacts that you take the time to create. many smaller organizations don't have any artifacts other than their requirements documents and source code. discover which artifacts need to be created by augmenting your bug tracker (see bug tracker hell and how to get out! ). any phase of development where significant defects are coming from should be documented with an appropriate artifact and be subject to inspections.
good books on how to perform inspections:
- gilb, tom and graham, dorothy ; software inspections ; addison wesley, reading, ma; 1993; isbn 10: 0201631814.
- radice, ronald a. ; high qualitiy low cost software inspections ; paradoxicon publishingl andover, ma; isbn 0-9645913-1-6; 2002; 479 pages.
- wiegers, karl e. ; peer reviews in software – a practical guide ; addison wesley longman, boston, ma; isbn 0-201-73485-0; 2002; 232 pages.
all statistics quoted from the economics of software quality by capers jones and olivier bonsignour:
|other engineering disasters|
|skylab (1979)||nasa's planners failed to account for sunspot activity causing drag on the satellite during a solar warming cycle causing the satellite to crash. cost: $10 billion in 2010 inflation adjusted dollars.|
|tacoma narrows bridge (1948)||engineers failed to account for wind sheer and the tacoma narrows bridge failed spectaculary when high winds caused the bridge to resonate and oscillate in perfect sine waves before breaking and falling apart. cost: $100 million in 2011 inflation adjusted dollars. video|
|the vasa (1628)||the vasa was built top-heavy with insufficient ballast and foundered and sunk in 32 meters of water just 120 meters from shore as soon as she encountered a wind stronger than a breeze, just a few minutes after first setting sail on her maiden voyage on august, 10th, 1628. despite clearly lacking stability even in port, she was allowed to set sail.|
Published at DZone with permission of Dalip Mahal, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.