Considerable research
throughout the 1970's, 80's and 90's repeatedly found formal design
and code inspections, when done well, significantly increased software
development productivity and decreased the time and cost of testing.
Over the last decade, however, development tools have
improved substantially and many organizations have adopted so-called agile approaches and processes.
For those that have not embraced, or cannot embrace, agile approaches,
and
continue to use traditional tools and processes to produce software,
one of the best quality assurance
improvements a team or organization can make is still the introduction
of
effective inspections. The question is whether, with agile processes
and the latest development tools, more modern software development
practice
has outgrown the need for formal inspections?
For a large number of people, agile processes mean either Scrum, eXtreme Programming, Lean
Software Development, or some combination of all three.
Given this, the question of whether or not to perform formal
inspections is answered no in
the case of XP and
yes in the case of FDD. For
traditional teams, the answer is almost certainly yes given the
evidence of previous generations of software development. Therefore, it
seems
to do inspections or not remains a question only for teams
following Scrum, Lean, Kanban, etc, or some home-blended, mixture of
all of these.
To answer this question for agile approaches in general, we look
first at traditional inspections to understand what we might
adapt, then at how FDD has adapted inspections, compare inspections
with pair-programming and, finally,
suggest some ideas for introducing inspections in other
agile approaches.
Obviously, the question is not as simple whether to do formal
inspections or not. There is the question of whether a team is able to
perform
inspections well or not.
Doing inspections badly is no good to anyone, any more than practicing
pair-programming or collective ownership poorly is useful.
The
definitive book
on doing inspections well is generally regarded to be Tom Gilb and
Dorothy Graham's, Software
Inspection. This builds
on pioneering work by Michael
E. Fagan at IBM. Published in 1993, the book reads as quite dated
now, especially the examples and case studies. Nevertheless, we can
still examine the underlying principles, techniques and strategies
described for performing effective inspections in a traditional
development environment. Once a team understands
these, it is in a far better position to compare and contrast
inspections with pair
programming as a means of assuring quality, and how they might adapt
inspections to fit within the specific ways they work, agile or not.
The primary purpose of a formal design and code inspection is the
removal
of defects from the items being inspected. The idea is to identify and
remove defects as early as possible because it costs significantly more
to identify
and remove defects later in a project. This is no different than the
idea of customers 'inspecting' and giving
feedback on completed work at the end of each development iteration
(sprint)
in Scrum. In both cases, the cost of inspecting
is assumed to be
significantly less than the cost of identifying and removing defects
later rather than earlier. This assumption must prove to be true.
Otherwise inspections are bot worthwhile.
In addition to defect removal, formal inspections should, if done well,
provide
a number of other benefits (see figure 1):

Figure 1: Inspection outputs
Examining the designs and code of
experienced, knowledgeable developers, having them walkthrough them
explaining the techniques they use, enables less experienced developers
to learn from them.
Similarly, those new to the organization, or maybe just new to the
project team, quickly learn how things are done in that organization or
team. Inspection leaders know to look for and facilitate this knowledge
transfer during an inspection but only in as far as it does not
distract from the primary purpose of removing defects. Inspections are
not a vehicle for senior developers to wax lyrically for hours about
their experience. Inspections are about improving quality primarily
through identification and removal of defects and secondarily by
increasing the knowledge and skill of developers.
As well as listing defects, reviewers in
an inspection may make suggestions including things like:
Any kind of habitual review, walkthrough
or inspection scheme is
likely, at some point, to discover some bad assumptions made about
requirements. The result is new or updates to existing requirements. In
traditional development, such assumptions may otherwise only surface at
the
end of the project during system test, or not until after the software
has been released and deployed into production.
If we capture and examine metrics on the
type and number of defects found, common problem areas reveal
themselves. Once these problem areas are known, this can be fed back to
developers and addressed. Additionally, the metrics can prove
useful in convincing management of the benefit of the inspection
process, and in further tailoring it to be more effective.
Alternatively, they can prove that the current inspection scheme is not
effective and either should be dropped altogether or changed to
improved it.
Agile processes generally approve of, if not insist on, knowledge sharing, continuous improvement of the process, and adapting to changes in requirements. Metric collection is, therefore,the only secondary benefit of inspections that might be considered irrelevant in to an agile project. Nevertheless, the use to which the metrics are put, process improvement and ensuring a project activity is worthwhile, fit comfortably within agile thinking. Of course, this assumes all this can be done without drowning the team in paperwork seriously from the frequent delivery of tangible, working software.

Figure 2: Inspection 'Process'
In a traditional environment, trained inspection
leaders
organise and facilitate inspections at the request of the authors of
items needing inspection.
Once a leader is identified for a particular inspection, their first
task is to ensure that the item being inspected is
ready. The easiest way to do this consistently is to agree and maintain
a checklist of entry criteria. Authors are
expected to have compared their work against the checklist before
asking for an inspection. If the items to be inspected fail any of
checks in the checklist, the authors must correct the
problem before asking for an inspection again. Few things are more
frustrating than discovering the authors of items being inspected have
not done the basic work needed to make the inspection worthwhile.
Without agreed entry criteria, it is all too tempting for some authors
to
submit items too early, expecting team-mates to do their thinking and
basic checking for them.
The inspection leader prints and signs a more formal checklist page
to prove
that the entry criteria were all fulfilled by the items to be
inspected. The
signed checklist forms part
of the formal output of the inspection. Alternatively, this can be done
on-line using a purpose-built or suitable general-purpose application.
| Inspection
of: |
Date: |
| 1. Does the
code compiles without errors and any unnecessary warnings? |
[
] |
| 2. Have all the required unit
tests been written and do they pass without reporting any problems? |
[ ] |
| 3. Does the code pass all
the agreed static analysis tool checks? |
[ ] |
| 4. Does the code look like it
has
been commented sufficiently and Javadoc or equivalent run without
reporting errors? |
[ ] |
| 5. Has the code been formatted
using the agreed tool and agreed settings so that it is easier to read
because the format is familiar? |
[ ] |
| 6. all the code and related
files have been checked into the team's
source control / configuration management repository? |
[ ] |
| Checked
By: |
Figure
3: Formal Inspection Entry Checklist Example
Two hours inspecting something is usually more than enough time to
spend in one go. Any longer and fatigue sets in rapidly reducing the
effectiveness of the inspection. Therefore, an inspection leader must
assess whether
an
item is too big or complex to inspect in one sitting. With traditional
development, items are
quite often too large to be inspected in one go and both design and
code
inspections frequently need to be split into digestible
pieces.
For design inspections, reviewers are looking for:
Code inspections are similar with reviewers looking for things like:
It’s amazing how creating a simple checklist of things to look for can improve the effectiveness of a reviewer. A checklist that starts as simple as something like:
really does help reviewers cover the ground that they need to when checking designs. This is especially true if the team work together to create the initial list.
I have also found that if the items on list are kept concise, the
team quickly starts to remember most of the items on
list, especially the ones that are truly useful to them. After a
while many of the items can be removed from the list because they
are checked by habit. This makes room for new items to be added to the
list arising from issues found and suggestions made during inspections,
testing and customer demonstrations.
Design inspection
checklists tend to be harder to create than code inspection checklists.
Code inspection checklists are typically derived from the headings in
existing coding standards, ignoring the items that can be checked
automatically by compilers, static code analysis tools, and tools like
javadoc that generate documentation from source code comments. In
contrast, too many design review checklists are over-wordy because the
authors
cannot resist including explanations of why items are on the list. The
list is a memory aid and an organising construct, not an instruction
manual or pedagogical essay. One way to avoid this is to think of a
template for a traditional design specification document that has
instructions for what to put in each section. Then consider what the
table of
contents for that document might look like and use that as the starting
point for the
check-list.
To be able to examine the effectiveness of inspections, it is important to record the time taken by each reviewer to check the items under inspection.
Called the logging meeting in the Software Inspection book, all the reviewers in the inspection meet together to review, agree on, and record their observations. The idea is to log all the items found with the minimal amount of discussion. Three types of item are logged:
The meeting usually proceeds page by page with reviewers
volunteering any items they have noted on those pages. One person in
the
meeting, nominated as the scribe either before the meeting by the
inspection organiser or by general consent at the beginning of
the meeting, records all the items in a simple list. Typically this is
done on paper and typed up after the meeting if an electronic copy is
useful. Figure 4 shows an example of a typical list of items from a
code inspection meeting. Each item:
| Inspection
of: |
Date: | Page:
|
| Item
# |
Line
# |
Type
(I/Q/S) |
Description
of Item |
Severity (H/L) | Corrected |
|---|---|---|---|---|---|
| Person Class |
[ ] |
||||
| 1 |
102 |
I |
Null parameter check
needed |
H |
[ ] |
| 2 |
178 |
I |
Doc for
InvalidDateException missing in comment |
L |
[ ] |
| 3 |
S |
Add running
api doc gen to inspection entry checklist |
[ ] |
||
| Loan Class |
[ ] |
||||
| 4 |
317 |
Q |
Can percentage value
supplied by user be greater than 100%? |
[ ] |
|
| 5 |
521 |
I |
Possible divide by
zero in calc |
H |
[ ] |
| .. |
.. |
.. |
.. |
.. |
.. |
Figure
4: Inspection Meeting Item List Example
Instead of filling in a form, the items can be noted on the authors
copy of the items being inspected. While this is slightly faster and
easier to do in the meeting, it is also easier to miss addressing a
particular item afterwards and less easy to:
Finally, for authors in a code inspection, do not turn up with a different version of the code to that which was distributed for the inspection. Reviewers will have made notes on their copies and a good deal of time will be wasted trying to ensure everyone is on the same page at the same time.
At the end of an inspection meeting, the inspection team need to
decide on an overall assessment. There are four possibilities:
The overall result is recorded on a cover sheet for the inspection
together with the usual sort of information captured for normal meeting
minutes including items such as:
The authors of material inspected are responsible for investigating
and addressing all the issues and questions logged in the inspection
meeting, working with others to resolve major issues as necessary. The
authors may request the inspection leader to convene follow-up
meetings to brainstorm some of the suggestions and more complex issues
raised. Not all the issues logged will turn out to be defects. The
inspection meeting does not always have the required knowledge
available in the room to confirm if an issue is definitely a defect or
not. Sometimes, on investigation, a logged item turns out to be a
non-issue.
Once, the authors have addressed all the issues and questions logged,
the inspection leader either arranges another inspection or confirms
that all logged items have been addressed adequately depending on the
overall result of the inspection meeting.
In addition, the inspection leader ensures that:
Feature-Driven Development (FDD) is designed with inspections
at its core, having adapted them to fit
seamlessly within its processes. The FDD process descriptions, however,
assume familiarity with the
fundamentals of conducting software inspections. FDD process
descriptions are not intended as
instructional guides or tutorials. They are intended more as memory
aids. For example,
certain sections of Tom Gilb's book were
required reading for Chief Programmers on the first FDD project. After
reading and understanding those, it required only a little guidance on
when and how to fit
inspections into the overall process for the team to establish the
practice.
In FDD, small groups of features are taken through a set of
milestones, including a design inspection milestone and a code
inspection milestone, by a small team of developers called a
feature team led by a Chief Programmer.
The inspection leader role is performed by the Chief Programmer.
FDD does not insist on a formal entry checklist for inspections.
Ultimately, the Chief Programmer is responsible for deciding when the
features being worked on are ready for design or code inspection.
The
checklist for items might consist of no more than
half a dozen items, scribbled on
large piece of paper and pinned up where all team members can see it.
Alternatively, the same
list might be presented in a simple web page on the project's intranet
site. Figure 5 shows an example of items that might comprise an entry
checklist for
a code inspection.

Figure
5: Informal Code Inspection Entry Checklist Example
One of the big differences with agile development is that development is done iteratively in small slices. As a result, items from agile development processes are very rarely so big. In my experience, few design or code inspections in an FDD project require more than an hour of checking, or more than an hour-long inspection meeting. Nevertheless, on occasion, complex items may still need to be inspected in two or three manageable pieces instead of one big one.
FDD generally makes working out who to invite easy because FDD requires all a feature team's members to inspect each other's design and code.
Other members of the wider development team are invited at the Chief Programmer's discretion for particularly significant or complex features. In FDD, if a design is going to impact the work of other feature teams, the Chief programmer is expected to widen the design inspection to include other Chief Programmers. Scenarios where this might be needed include:
In my experience, for a
team writing object-oriented code and associated JUnit-style unit
tests, it is useful to ask each reviewer in a code inspection to
concentrate on:
It is important to spread similar or related pieces across reviewers. This way one reviewer's comments during the inspection meeting can trigger another reviewer to check for the same issue in the pieces they were assigned.For design reviews that requires some sort of printed version of the design for the feature/user story/use case/back log item being worked on, even if it is no more than a photo of a diagram sketched on a white board.
In all other aspects, the preparation for an inspection in FDD is not that different from a traditional inspection.
The team checks
the sequence diagrams, class diagram updates and other design notes
agreed during the team's collaborative design session and domain
walkthrough for the features involved in this iteration. These are
generally written up
in some electronic form and posted on the project's intranet so the
design inspection ensures that this has been done without error.
It is tempting to devise a standard template for publishing designs.
There is nothing intrinsically wrong with having a standard template
and it can often speed up the process. The problem comes when the team
spend more time
during a design inspection pointing out non-compliance in things like
the fonts, paragraph and
heading styles used, trivial grammatical correctness, and the lack of
introductory content than in the design being described. Yes, a design
document needs to communicate design adequately, but
it
is far more important to get the design right. Correctly formatting a
design document to effectively communicate a poor or broken design is a
waste of time. This is probably the biggest difference from traditional
inspections where the rules for constructing and formatting the
document are considered important.
There are times when reviewing the actual document is required; when the document standards or templates are set by regulators or by a formal contract. However, that is a document inspection not a design inspection. Beware confusing the two. A design inspection is far more important than a document inspection, even when the document inspection is truly needed.
In my experience, the easiest way to check source code is to print
it out, single-sided, landscape-oriented with two pages of source to
one printed page. Marking up issues, questions and suggestions
electronically is slower than scribbling them onto printouts. As tablet
and pen-input or stylus -input devices improve, this might change.
In FDD, the
feature team are the authors and so work together to investigate and
correct the issues found as necessary. The collection, recording and
summarizing of metrics from inspections are left for each individual
project to define as suits its working environment.
The small team and chief
programmer oriented
structure of FDD, complements formal inspections beautifully. In fact,
the mix of feature teams and inspections
adds a new dimension to traditional inspections.While formal case
studies do not exist, personal experience would indicate that FDD's
feature teams and short, structured iterations make inspections easier
to establish and perform effectively within FDD than in traditional
environments.
With Chief Programmers controlling the level of formality of each inspection as needed, wasted overhead from unnecessarily formal inspections for straight-forward designs and code is largely eliminated. Of course, this relies on the availability of experienced and skilled developers in the Chief Programmer role but this is the case for any aspect of an FDD project. In contrast, traditional inspections rely on the availability of trained, expert inspection leaders, a more specialist role than an FDD Chief Programmer.
Pair-programming is defined as two developers working together at a
computer. All code on the project is written in this way. The idea is
that all design and code is checked as it is written with many errors
and defects detected and removed as soon as they are introduced.
Comparing the costs and benefits of pair-programming and inspections we
have:
It is very hard to formally measure the effectiveness of
pair-programming in detecting and removing defects because it is
impossible to determine which of the defects would be seen by a
developer working alone and which would not. The only measure of
effectiveness of pair-programming in defect removal is counting how
many defects are found after the pair have completed the work. No
mechanism exists in eXterme Progrmaming for collecting such a count.
Collective ownership ensures that any defects found in subsequent work
are fixed as they are found. No measure is taken of the number of
defects found or fixed in this way.
In an agile environment, bad
assumptions maybe caught by pair programming but not if both authors
are labouring
under the same misconception (or one convinces the other that the
assumption is good). In this case, it is unlikely that unit
testing will catch the problem because the author/s are likely to build
the assumption into the logic of their unit tests. Similarly, a
demonstration at the customer of the iteration may not reveal the
underlying bad assumption because the demo may not cover a scenario
where it is visible. Only inspections and pair-programming look at the
source
code, unit tests and demonstrations do not.
One of the nice things about inspections is they provide a pause,
time
to think, and the opportunity for fresh eyes to look at the design or
code. Pair-programming does not. While inspections take a step back and
consider the
design or source code as a whole, pair-programming concentrates
more on what is being worked on
right at that moment. In addition, inspections provide a welcome hour
or so away from the computer screen assuming the common practice of
printing designs and source code for
inspection. This respite can help reduce the errors made and time spent
sorting out problems caused by developer fatigue from too long spent at
the keyboard.
Pair programming transfers knowledge on a one-to-one basis. An
inspection broadcasts knowledge among a larger audience of reviewers.
In FDD,
this audience is at least the full feature team if not wider. The
transfer of knowledge in inspections is not only wider than that of
pair -programming but qualified, and verified
because a Chief Programmer is present to ensure the techniques learned
are good. A pair
of developers can teach each other bad
habits just as easily as good habits.
Pair programming does nothing formally to improve process. Informally, discussion between pairs of developers as the work together will inevitably result in process improvement suggestions. Inspections provide a slightly more structured means of raising and evaluating such suggestions, including changes to inspection entry and reviewer checklist contents. Most agile processes provide channels for process improvement suggestions to be raised and discussed. On the whole, frequent process improvement is emphasised and practiced more within agile approaches than traditional approaches to software development regardless of whether inspections or pair-programming is used.
The dynamic and continuous nature of pair-programming makes it very
hard to collect any sort of metric without setting up an artificial
experiment for exactly that purpose. Basic quality metrics are
relatively easy to collect during inspections.
The cost of doing inspections is easy to measure. The time spent by
the inspection leader, each reviewer's individual checking and the
inspection meeting are easy to record. For a feature team, this is
certainly a significant amount of time. In pair-programming, it is even
easier to measure because all coding is done in pairs. Everything has
the overhead of the second developer in the pair. Studies to determine
the difference in cost between continuous pair-programming and well-run
formal inspections do not, to my knowledge, exist.
Even if such studies existed, they would also need to account for
occasional 'pair-programming' within FDD feature teams. Members of
feature teams in FDD are free to pair up
during
coding when this is desirable. It is not unusual to see two members of
a feature team working together where care is needed or where one is
struggling with a particular problem. One of the great
things about feature teams is that a feature is complete only when the
team is finished not when any one individual is finished; it is in the
team members' own interests to help each other.
What would formal inspections look like on a Scrum, Lean or Kanban
project? These development teams are frequently very small with two to
six developers, occasionally as many as eight or nine. This means the
often inspections would need to involve at least half the team, and for
the smallest teams each inspection would involve the whole team.
The inspection leader role could be rotated among the team or, if the team has a coach or scrum master with enough time, they could play the facilitating aspects of this role instead. It is definitely worth asking for some coaching from someone experienced in holding inspections if the team has not done inspections before.
For Scrum, Lean and Kanban, I see no reason why inspection entry
checklists would not be handled in a similar way to they are in FDD
projects. Chunking is similar.
Who to invite to an inspection is easily solved for smaller teams because the limited size of the team means usually everyone plays a role in each inspection. For a slightly larger team, one or two developers could be left out of a particular inspection if they are short of time on some other task. One would have to beware, however, of letting the same people off each time.
The rest of the mechanics of operating inspections on these projects
are likely to be very similar those used in FDD. The only other
question is when to perform inspections within these processes. Scrum
teams will have to decide for themselves exactly when inspections are
done. They should, of course be completed within the current sprint.
Work should not be considered done unless it has been inspected or the
inspection waived by consensus within the team.
Kanban provides the added dimension of workstations on the kanban
board where entry to one workstation from the previous one is
controlled by the amount of work in progress in that work station.
Inspections can be added to particular workstations so that not only
entry to workstations are controlled but the exit is controlled by
passing the appropriate type of inspection. Alternatively, like FDD, a
workstation could represent the performing of a particular type of
inspection: requirements, design or code, etc.