Information Technology Reference
In-Depth Information
These tools also work very well in geographically distributed
teams (i.e., some developers work from home, others at the office, and
others in another state, country, continent, etc.). It helps mitigate any
additional risks with people out of range for verbal collaboration.
Automated static code analysis scales more efficiently than
humans for large code bases; some tools offer hundreds of different
rules, which a human can't possibly remember while reviewing a
series of files. Moreover, running a tool's myriad rules against your
code base will take less time than having your partner review one
package. Having a human manage the review of all code is a costly
proposition!
Automating code inspections with analysis tools handles 80% of
the big picture and allows humans to intervene in the 20% that matters.
For instance, Java's PMD will run 180+ rules against a file every time
it changes. If a particularly important rule is violated, such as a high
cyclomatic complexity 2 value, someone can take a look. Can you
imagine trying to accomplish this targeting process manually? Why
would anyone want to? The key to remember with automated code
reviews is that they are not a replacement for manual ones—they are
merely an enhancement for applying human intelligence where it's
most needed.
We are not advocating an “either/or” scenario in which you must
decide which review technique to use, automated or manual. Auto-
mated inspection tools augment in-person reviews, and they have
become necessary because code has become infinitely longer and
denser. The beauty with automating code inspections is that when you
do perform a manual review, the process is much more effective
because the low-level details of code have already been scanned. The
human reviews become more focused on aspects that automated tools
cannot process, such as whether the code meets the requirements and
if it will be easy to maintain in the long run.
Figure 7-1 demonstrates how inspection is another piece of the
one-command build necessary for running a CI system.
2. Cyclomatic complexity is the number of paths through a section of code such
as a method. It is discussed more later in this chapter.
Search WWH ::




Custom Search