Improving Code Quality PDF
Improving Code Quality PDF
Improving Code Quality PDF
Editors: Nan Barber and Brian Foster Interior Designer: David Futato
Production Editor: Shiny Kalapurakkel Cover Designer: Karen Montgomery
Copyeditor: Octal Publishing, Inc. Illustrator: Rebecca Demarest
Proofreader: Amanda Kersey
The OReilly logo is a registered trademark of OReilly Media, Inc. Improving Code
Quality, the cover image, and related trade dress are trademarks of OReilly Media,
Inc.
While the publisher and the author have used good faith efforts to ensure that the
information and instructions contained in this work are accurate, the publisher and
the author disclaim all responsibility for errors or omissions, including without limi
tation responsibility for damages resulting from the use of or reliance on this work.
Use of the information and instructions contained in this work is at your own risk. If
any code samples or other technology this work contains or describes is subject to
open source licenses or the intellectual property rights of others, it is your responsi
bility to ensure that your use thereof complies with such licenses and/or rights.
978-1-491-98507-6
[LSI]
Table of Contents
Preface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vii
v
Preface
vii
quality is addressed in their organizations. As detailed in this report,
survey respondents came from a wide variety of settings, from start
ups to large enterprises, and including both closed source and open
source projects.
This report provides detailed results for answers to each question in
the survey, along with observations on key correlations among the
answers. At the highest level, the survey produced four major find
ings. Lets take a look at each of them in the sections that follow.
Lack of Resources
Most developers do not use tools for improving software quality. In
large part, this is because they lack the budget to acquire them. One
part of the problem here was addressed in the previous point: lack
ing adequate tools, programmers simply will not be able to maintain
code quality at the level they would like to. Beyond that, however,
lies a deeper issue for organizations, namely that they are not dedi
cating enough resourcesor, in some cases, communicating the
availability of those resourcesto enable their development teams
to deliver high-quality code using a consistent, empirical methodol
ogy.
As detailed in Code Quality Tools on page 7, more than 70 percent
of survey respondents reported that they have no budget reserved
for code quality toolsnot even a few dollars per month. SIGs
hands-on experience with development teams in organizations
viii | Preface
across a range of sizes and sectors shows clearly that use of the right
tools and methodologies for code quality has a marked impact on
the performance, stability, security, and maintainability of enterprise
software. In general, paying attention to code quality is the best way
to make software future-proof. Yet, these survey results reveal that
most organizations have not embraced this truth, at least as reflected
by their budget priorities.
Preface | ix
Acknowledgements
Special thanks to SIGs CTO, Dr. Joost Visser, and OReillys techni
cal reviewer, Abraham Marn-Prez, for their invaluable comments
on the manuscript of this report.
x | Preface
Improving Code Quality
Figure 1-1. Which option describes your working situation best? (only
one answer permitted)
1
It might be that large companies stand to benefit the most from giv
ing systematic attention to code quality. When an organization has
more developers and a larger code base, implementing best practices
for code quality can have a much greater impact on maintainability,
security, technical debt, and so on, thereby saving far more resour
ces over time.
Although a clear majority of respondents work on closed source
projects (as illustrated in Figure 1-2), more than one-quarter (28
percent) work primarily on open source projects.
Figure 1-2. What projects do you typically work on? (only one answer
permitted)
Figure 1-3. Which technologies are you mostly developing in? (multiple
answers permitted)
Not surprisingly, correlating these results with those from the previ
ous question, a number of the code quality tools were more com
monly used among those respondents who reported that they had a
budget for such tools.
Returning to a point made in the Preface, the lack of a budget for
software quality tools inhibits programmers ability to maintain
code quality as they should (and as they say they want to). The lack
of a budget also indicates that many organizations, regardless of
what they might say about code quality, are not putting their money
where their mouths are in terms of allotting the resources needed to
ensure that quality code is in fact produced.
The results for the question in Figure 1-9 are not surprising, given
the answers to other questions in the survey; for example, the 29
percent of developers polled who answered None when asked
which code quality tools and methods they use. In this answer, 38
percent reported Never using code quality tools, 26 percent
reported using them Sometimes, and 36 percent reported using
them Always or Most of the time.
Figure 1-9. How often do you use code quality tools in the projects you
work on? (only one answer permitted)
Figure 1-10. What are the most important reasons to choose a specific
code quality tool? (multiple answers permitted; answers from respond
ents who answered Always to How often do you use code quality
tools in the projects you work on?)
Figure 1-11. In the cases when you use code quality tools, what are the
most important reasons to choose a specific code quality tool? (multi
ple answers permitted; answers from respondents who answered Most
of the time or Sometimes to How often do you use code quality
tools in the projects you work on?)
Note, also, that money once again becomes a major barrier prevent
ing the use of code quality tools in many cases, even for program
mers who often use them. It appears that some developers regularly
use tools to ensure code quality when they are working with certain
technologies, yet avoid using tools to analyze their work in other
technologies because price is seen as prohibitive. If this is indeed the
case, it can be worthwhile for an organization to evaluate how this
pattern of tool use affects quality, both overall and for the most
important technologies in use, and then reallocate money as needed
(or even, in some cases, choose different technologies).
As shown in Figure 1-13, it seems that programmers who do use
code quality tools find them useful for many different reasons. In
response to this question, developers tended to cite multiple answers
(5.6 on average), and 13 separate answer choices were selected by at
least 20 percent of respondents.
These results might indicate that failure to use code quality tools ari
ses more from lack of familiarity with them, or lack of understand
ing about the value of them, than from any specific technical or
business reason. As suggested in the Preface, institutional and per
sonal inertia might be the overriding factor. It seems likely that bet
ter training for developers, along with allotment of more budget,
could have a meaningful impact on the adoption of these tools
with corresponding positive impacts on code quality.
Further Analysis
There is good news to be found in the results of the SIG/OReilly
survey. For example, it is a good sign that three-quarters of develop
ers polled consider code quality to be a shared responsibility of the
entire team and the individual developer. In other words, most pro
grammers are perfectly willing to be held accountable for the quality
of the code they create.
Unfortunately, the results of this pollcombined with decades of
SIG field experiencealso reinforce the conclusion that too many
organizations treat code quality as an afterthought. It is considered
an issue that developers must solve for themselves, usually through
ill-defined means, rather than a priority that is shared throughout
the organization and implemented from the beginning to the end of
each software project.
The findings of this collaborative poll with OReilly also tend to
reinforce earlier research carried out by SIG. That research deter
mined that software development organizations fail to use code
quality standards for three main reasons:
Further Analysis | 15
There is insufficient institutional urgency to adopt code quality
standards.
They have not reached internal consensus about what software
quality is and how it should be measured.
They lack management support and a budget to establish and
maintain adequate standards.