Вы находитесь на странице: 1из 32

FACILITATING THE SPREAD OF KNOWLEDGE AND INNOVATION IN PROFESSIONAL SOFTWARE DEVELOPMENT

Technical Debt and


Software Craftsmanship eMag Issue 27 - April 2015

ARTICLE INTERVIEW ARTICLE

Creating a Culture James Grenning on Managing


of Quality Technical Excellence Technical Debt
Technical Debt and Software Craftsmanship // eMag Issue 27 - Apr 2015 1
Bad Code, Craftsmanship, Creating a Culture of Quality
Engineering & Certification Every company wants to delight customers with a high-
quality product, and many organizations naturally focus
Robert C. Martin, during his keynote at QCon London 2010, on process improvements to reach quality goals. But
tried to figure out why there is so much bad code written. He organizational culture eats process for breakfast. So how
offers advice on writing good code talking about a bad code do you create a culture of quality? New research on 850
example, Boy Scout rule, functions, arguments, craftsmanship, employees who impact quality from 80 companies presents
TDD, continuous integration, pairing, small cycles, patterns, new strategies for shifting values, norms, beliefs, and habits.
engineering, certification, and other elements contributing to
quality code.

Michael Feathers on
Technical Debt, Process,
and Culture
Michael Feathers offers advice on creating an
organizational process and culture that can enhance
software development in a way that reduces technical
debt.

Managing
Technical Debt
Technical Debt is widely regarded as a bad
thing that should be paid back as soon as
possible, however it can be a strategy that
helps balance short-term wins and long-
term productivity. This article describes
different ways that a project could pay
back Technical Debt and what factors must
be considered when deciding if you should
repay, convert debt or just pay the interest.

Technical Debt: James Grenning on


A Repayment Plan Technical Excellence
All teams eventually face technical debt. In this article Jeremy At the recent Agile Singapore conference James Greening
presents what technical debt is...and isnt, as well as introducing presented two technically focused talks - one on the
some of the different types of technical debt and how to deal with importance of technical excellence and the other teaching
them. Finally, he presents a metaphor for understanding technical test driven development. He spoke to InfoQ about the
debt, explaining it to stakeholders, and then dealing with it in an importance of strong technical practices to enable true
efficient way. agility in software development.

FOLLOW US CONTACT US
GENERAL FEEDBACK feedback@infoq.com

ADVERTISING sales@infoq.com

EDITORIAL editors@infoq.com
facebook.com @InfoQ google.com linkedin.com
/InfoQ /+InfoQ company/infoq
NEW YORK
Jun 8-12, 2015
Conference for Professional Software Developers
qconnewyork.com

SAVE $100 WHEN YOU REGISTER WITH PROMO CODE TECHDEBT


Tracks for QCon NY 2015
Applied Data Science and Machine Learn- High Performance Streaming Data - Scal-
ing - Putting your data to use. The latest pro- able architectures and high-performance
duction methods for deriving novel insights frameworks for immediate data over per-
Engineering Culture - Building and scaling a sistent connections
compelling engineering culture Reactive Architecture Tactics - The how
Modern Advances in Java Technology - Tips, of the Reactive movement: Release It! tech-
techniques and technologies at the cutting niques, Rx, Failure Concepts, Throughput,
edge of modern Java Availability

Monoliths to Microservices - How to evolve Architectures Youve Always Wondered


beyond a monolithic system -- successful mi- about - Learn from the architectures power-
gration and implementation stories ing some of the most popular applications
and sites
The Art of Software Design - Software Arch
as a craft, scenario based examples and gen- Continuously Deploying Containers in Pro-
eral guidance duction - Production ready patterns for grow-
ing containerization in your environment
Architecting for Failure - War stories and les-
sons learned from building highly robust and Mobile and IoT at Scale - Trends and technol-
resilient systems ogies for building mobile applications

Emerging Technologies in Front-end De- Modern Computer Science in the Real


velopment - The state of the art in client-side World - How modern CS tackles problems in
web development the real world

Fraud Detection and Hack Prevention - Optimizing Yourself - Maximizing your im-
Businesses are built around trust in systems pact as an engineer, as a leader, and as a per-
and data. Securing systems and fighting fraud son
throughout the data in them.
SHANE is an agile coach, trainer and consultant working for SoftEd in Australia,
New Zealand and around the world. He is the lead editor for Process
HASTIE and Practice on InfoQ.com and blogs on the SoftEd blog.

necessary for a quality culture to flourish. The quality


of the product is a manifestation of the quality of the
process that was used to create it, he writes.
Building on the culture theme, Michael
Featherss 2012 IEEE Software Experts Summit talk
examined the different types of technical debt. He
argues that not all technical debt is bad but it is
unavoidable and we need to plan and budget to
address it so it doesnt inhibit new value. He identifies
a variety of factors that contribute to technical debt
and places where it is likely to accumulate in a
codebase and presents some advice on how to deal
with them. According to Feathers, technical debt is
the effect of unavoidable growth and remnants of
inertia inside software systems.
A LETTER FROM Sven Johann and Eberhard Wolff present
some ideas about managing technical debt. They
THE EDITOR challenge the idea that technical debt should always
be paid back as quickly as possible and present
the case for consciously selecting which areas
Technical debt is a hackneyed phrase that refers and types of technical debt are worth addressing
to the likely cost of maintaining and enhancing a and which can be left to chance. They discuss the
software product. To many, the existence of technical surprising variety of stakeholders who have interest
debt is a curse and indicates a lack of professionalism in technical debt and what those interests are. They
or craftsmanship in the code whereas others find it discuss some ways to select the areas to address and
a natural by-product of the many different trade-offs different approaches to addressing the accumulated
that have to be made when delivering solutions to debt. They conclude that messy code, which is rarely
meet market and organisational needs. Whatever read or touched and doesnt implement important
way you view it, technical debt is something that will requirements, does not have to be absolutely perfect
most probably impact every codebase at some point. and therefore we dont need to spend a lot of effort
This e-mag brings together a number of authors who on refactoring it into great code.
have addressed the topic on InfoQ and suggests ways Jeremy Jarrell presents his thoughts in
to identify, monetize, and tackle technical debt in Technical Debt: A Repayment Plan. He discusses
your products. the types of debt and the importance of putting
We start with a prcis of Robert Uncle Bob aside some of the teams budget for addressing both
Martins 2010 QCon keynote in which he presented bit rot and consciously incurred technical debt. He
a clear picture of what bad code is and how code suggests how to identify the necessary budget and
rot happens, gave sound advice on how to avoid where and when to spend it: Like financial debt,
it, and discussed important aspects of software when taking on technical debt, we need to establish
craftsmanship. He emphasizes the importance of how and when it will be repaid.
code quality as a means to speed development: The Finally, in an interview from Agile
only way to really go fast is to go as well as you possibly Singapore2014, James Grenning reminded us what
can. technical excellence actually means, why it is so
Jonathan Levene has written about how to important that strong technical practices become
create a culture of quality. He asks why so many the norm, and the value of constantly learning about
quality initiatives do not succeed and presents his our craft as well as the product under development.
thoughts on creating a pervasive quality culture He calls test-driven development one of the
that will allow true craftsmanship to emerge and important techniques to use to prevent bit rot and
flourish. He identifies effective leadership, credibility maintain a high-quality codebase. Most people are
of the message, peer involvement, and ownership doing the best that they know but they dont know
and empowerment of team members as elements what they dont know, he cautions.

4 Technical Debt and Software Craftsmanship // eMag Issue 27 - Apr 2015


READ ONLINE ON InfoQ

Bad Code, Craftsmanship, Engineering &


Certification

Robert C. Martin (Uncle Bob) has been a software professional since 1970 and an international
software consultant since 1990. He is founder and president of Object Mentor Inc., a team of
experienced consultants who mentor their clients worldwide in the fields of C++, Java, OO,
Patterns, UML, Agile Methodologies, and Extreme Programming.

In his keynote at QCon London 2010, Robert C. Martin tried to figure out why
developers write so much bad code.

He opened his talk with an example of truly bad code: Is it the pressure of time schedules that makes us do the
two classes from a product that were massive and thing that slows us down? I will leave you to deal with
had very large methods. He described the nature of the oxymoronic consequences of that one. We must
the code and then asked how many in the audience make a mess because (it is) the only way for us to go
have been significantly impeded by bad code. fast. So, we accept the fact that it will slow us down
Almost everyone in the audience responded forever so that we can make a mess today and save 5
that bad code had impeded work. Martin challenged milliseconds. Obviously, that is probably not the right
them: trade-off to make. Is it just sheer laziness? I do not
Why did you write it? You know, of course, that it is think that the developers who wrote that thing were
going to impede you. You know, of course, that this lazy. You have got to work hard on a mess like that.
code will slow you down. What in the world would It takes real effort to keep that thing in such horrible
motivate you to do the thing that you know it is going situation. Maybe it was boredom, maybe these guys
to significantly impede you and everyone else on your just did not care anymore, maybe they were just going
team? Why in the world would someone write that in every single day and slinging code and collecting
code? their paycheck and going home saying Who the hell
He presented some potential excuses for why cares? Maybe that was it. I do not know. Or maybe
bad code could be written: they were benefiting themselves: Try to fire us. See if

Technical Debt and Software Craftsmanship // eMag Issue 27 - Apr 2015 5


anybody else can deal with this pile of crap that we what the code is doing. So, I like my functions to be
have created. Ha ha ha!Martin explained his view of short.
the essence of the software-craftsmanship movement: Martin said the best number of arguments
the only way to really go fast is to go as well as you a function should have is none: It is very easy to
possibly can. understand the arguments of a function when a
He admired the Boy Scout practice of leaving a function takes no arguments.
campground cleaner than when you found it. The next best number of arguments is one,
When you spend some time at a campground and then which is also easy to understand: pass one argument
you leave it, clean it up. Do a little bit more than just in, get one value out. As for more than one argument:
cleaning it up: improve it slightly. Two is not too bad. Humans are not bad at juggling
He indicated what would happen if we did the two things. They can keep two things in order. Usually,
same with our code: we have conventions for this, like X and Y we all
If we all did that with our code, our code will get know that X comes first and Y comes second.
incrementally better all the time. Every time we check Three starts to become a problem because when
a module out to do whatever we had to do with that you have three arguments, there are three different
module, we could clean it up a little bit and make ways to arrange them. What order do they come in?
sure that it was as clean or cleaner than it was when How many of you have seen a function that has three
we checked it out. We could take a moment to do arguments? It ought to be pretty obvious, but its not
one random act of kindness to the code: improve one if you spend hours looking at it only to eventually find
variable name or shorten one method, and then check that two of the arguments have been flipped.
it in just a little bit better than it was when we checked He discussed using Boolean values as
it out. And if we all did that, the codebase everywhere arguments:
would just gradually improve.He discussed some of Do not pass Booleans into functions. I will find
the characteristics of the bad code he had shown at the you. Booleans into functions are the worst possible
start. abomination. When you pass a Boolean into a
He asked how large a function should be and function, you are loudly declaring to the entire world
concluded it should take up one screen or less, that this function does two things: one in the true
meaning 20 lines at most and ideally only four or case, one in the false case. Why did you not make two
five lines long. He discussed the extract method functions? Have the caller call the right one. Do not
of refactoring (which many editors can do) and pass Booleans into functions and do not ever pass two
suggested a rule for using it: Booleans into a function.
My rule for keeping a function short is to extract Martin discussed naming conventions and
methods until you cannot extract methods anymore. I how the length of a name should be inversely
call this extract till you drop. You take every function proportional to its scope:
that you used and you start extracting and extracting There is a rule that I like to follow. The length of a
and continue to extract until you cannot extract name is inversely proportional to its scope. Long
anymore. By doing so, you are creating functions scopes, short names short scopes, long names. Say I
that literally do one thing. (There is only) one possible have a class with some public function. Those public
concept in that function, one level of abstraction in functions have a long scope so I want their names
that function. Every function is tiny. Every function to be short. An example of that is class file, public
calls other functions that have names. method, open for characters that is good. Open the
He explained how a large function is navigable file! But deep down inside the class, there would be
by someone who has worked with it for a long time as private methods and those private methods, especially
they are able to recognize the shape of the features if you are extracting until you drop, will have longer
and can use the landmarks to help them navigate and longer names so that they can be more and more
through it. Someone without that experience with precise about what they are doing. The worst you can
the code will be lost, as the landmarks mean nothing possibly have is a private method named G. No one
to them. Extracting the methods creates a map and is going to know what that means, right? We want to
puts the elements into well-named places: have private-method names that have nicely spelled
We chose our names carefully so that other people can out functions. And you know what is nice about that?
go through this code and say, What in the world does Hardly anyone calls those private methods. It is not
this code do? It is four lines long and the name of the like a million people are going to call the private
function is delete_all_rows(). Oh, I think I know what method. The private method only gets called by a few
this does. When your functions name tells you what methods so it is harmless to have really long names
the next four lines do, you can pretty well work out that specify what those private functions do.

6 Technical Debt and Software Craftsmanship // eMag Issue 27 - Apr 2015


He discussed the ideal size for a class: help us if we thought about that and then gradually
Well, it is hard to say a class should be four lines. It refactored it, according to the Boy Scout rule. Every
would be an interesting class that was four lines. We once in a while, we come around and say, That
need more than four lines in a class. We probably need function is a little too long. Lets split it apart. That
a hundred or maybe two hundred. A class is going to class is a little too big. Lets make two classes out of it.
be bigger than a function. And how many variables That way, we are always improving.
should a class have? Six? Eight, maybe? Two is good. Another element Martin discussed is getting rid
I like two. of all duplication:
We do not want to see lots of functions in a class. Of course, the final, horrible scene in any piece of
How many? Well, a few dozen. It would be okay to code is duplication. We want to get rid of as much
have 12 or 24 functions in a class, but I do not want duplication as possible. How many of you have seen
to see 700 functions in a class. I do not want to see code that looks like somebody got nuts with the mouse:
100 functions in a class. A class should be a short, scrape, paste, paste, paste, paste, paste. Oh, that piece
little batch of code, something nice to organize a few of code is really good! I think I will use it here and here
concepts that we put into a nice namespace with a nice and here and here.
name. The problem with that is that when you have to
He encouraged the audience to think about change it in one place, you have to change it in many
their actions when writing code: places, and if there was a bug in it when you copied
It would help us in our writing of code if we (think) it, you just replicated that bug throughout the whole
Uh, this class is a little too big. This function is a little batch of code. We dont want to see replicated code
too large. That name is a little too strange. It would at all. Any time there is duplication in the code, we

Technical Debt and Software Craftsmanship // eMag Issue 27 - Apr 2015 7


want that duplication eliminated through the use of long time, and how test-driven development helps
something called abstraction something that we achieve this:
are supposed to be good at, something that we are Nothing makes a software system more flexible that a
supposed to be masters of in our particular trade. We suite of tests. Nothing! By a huge order of magnitude.
use abstraction to eliminate duplication. You can have a terrible design but if you have a suite
Martin addressed the topic of craftsmanship of tests, you are not afraid to improve the design. But
and showed the audience the Manifesto for if you have a terrific design, you are afraid to touch it
Software Craftsmanship (http://manifesto. if you do not have tests. It is very difficult to improve
softwarecraftsmanship.org/). or change code that does not have tests. It is very, very
He discussed how the Agile Manifesto easy to modify and improve code if you do have tests.
(agilemanifesto.org) influenced the Manifesto for He discussed the value of continuous
Software Craftsmanship and how the latter takes the integration and the importance of build failures:
outcomes of the Agile Manifesto and extends them When we have a test failure in the build, we need to
with the ideals of craftsmanship. look at that as a critical event. Something has gone
He said that the idea of craftsmanship is based terribly wrong because something that used to work
on the need for disciplines that entered the field no longer works. So, we have to get on that fast. And
starting around 1995. The first of these is test-driven we should stop making progress everywhere and focus
development: our efforts on getting that thing to pass in a matter of
Nowadays, we have a set of disciplines that help us an hour or so and then everybody can relax and the
write code. And, of course, the one that I like the best build is back again. I want a little siren going Oh my
is test-driven development. Test-driven development God! Something is broken!
is one of those practices that started out remarkably He explained the danger of tolerating a broken
controversial, but the jury is in. It is no longer a big test in the build:
controversy. Some people still argue it, but it is no If you tolerate a broken test in the build, if you say to
longer a big controversy. Test-driven development yourself, Well, I will go back and fix that later, the
works! It works very, very well. It is a powerful next thing that you are going to do is to take that test
discipline that helps to organize your code, to organize out of the build because it turns the build red and that
your tests, to organize your time. It helps you with is ugly. So, you pat yourself on the back and you
your design. It helps you with everything else that you take it out of the build. Now, the build is green. Now
do in software. this is a behavior that you can repeat many times to
He challenged the audience regarding code keep the build green and everyone is happy because
coverage in unit tests: the build is green.
If you do not have coverage over it, if you cant test Of course, what you are doing is destroying the
it and, by the way, manual testing does not count, test. Then, at the release, somebody remembers finally,
because humans do not test things well. If you do not Oh, there are 18 tests we forgot to fix. And then you
have automated test coverage over your code, you do got a mess on your hands. Always keep the build
not know if it works. How can you, as a professional, passing by fixing any build errors immediately.
ship code that you are not certain works?... How can He advised taking a quality-first perspective to
I claim to be a professional and not know that my checking in code and ensuring the build does not
code works? The way to be sure is through test-driven get broken:
development. No developer should check in code until they are
He discussed other benefits derived from test- certain that it passes the build. So you should run a
driven development such as the courage to make private build before you have finished committing
changes to the code: your check-ins. You made a change; you should be
If you have a suite of tests that you can run, and if you able to run a private build on your machine.
trust those tests, then you can make the change. It is Martin challenged the argument that it takes a
a little hard, but you go in and make a small change long time to run a suite of tests and indicated that it is
and you run the tests and all the tests pass and you a symptom of dismissing the real value of tests. They
say, I did not break it! You make another small should be treated in the same way as production
improvement, you run the test, and you say, The test code:
passed. I did not break it! And as you learn to trust If your test suite is so long that it takes hours to run,
those tests, you realize that you can change the code. something is wrong somewhere. It means that you
He spoke about the importance of good design have been lazy with your tests; it means that you
and architecture how we want software to be well have allowed your test to take a long time. This is not
structured and maintainable, able to survive for a uncommon. When they are writing tests, people think
that tests are somehow different from production code,

8 Technical Debt and Software Craftsmanship // eMag Issue 27 - Apr 2015


that they should follow a different set of standards the best job you possibly can, you will adhere to your
than the production code does. We like our production disciplines and, hopefully, other people will observe
code to be fast, we like it to be efficient, but we look that you are massively outperforming them and they
at our tests and think, Well, who cares about them? will start to ask why. And they will adopt the things
No, we do care about them. We want our tests held to that you have begun to do.
the same standard as our production code. If our tests I think that, in the end, if we all just buckle down
are slow, it is because our tests are poorly designed. If and we do what we know we are supposed to do, write
our tests are rickety, if they break a lot, if you have the the best code we possibly can, write the tests we know
fragile-test problem, you have not designed your tests we are supposed to write, then, gradually, everything
well. You cannot look at test as some kind of second- else will change. Other people will join because they
class citizen. They are, for all intents and purposes, see it is a better approach.
equivalent to production code in the level that you He challenged the need to convince
must maintain them. management to allow teams to work in this way.
Next he discussed pair programming as a Management wants quality work and should support
technique of craftsmanship. He does not encourage methods that get teams there:
100% pairing: Management does not need convincing. Go ask a
I think there are tasks that you ought to be able to manager, Sir, what would you like? Good code or
work on your own for. You are writing for a bunch of crap?
error messages there is really no point in pairing. I guarantee you will get an answer that is not
Sometimes you cant pair; sometimes you have to crap. They are just not going to say, Oh, well, we want
think really hard and long on something. Usually, that crap. They are not going to do that.
means you are doing something wrong, but sometimes From that point on, you can say, You want good
you have to do it that way. All right, fine! So I am not code? Well, then I must work in a way that provides
going to tell you that you have to pair all the time. you good code. Thank you. Nothing else is necessary.
He does encourage a lot of time in pairing: You do not have to ask for permission to write tests
I think people ought to pair as much as they feel because they want good code: Then I am going to
comfortable with and that ought to be in the order have to write tests in order to give you good code.
of 50% to 70% of the time. You should be working You do not have to ask permission to pair because you
together, as a team. The worst possible situation for cannot give good code unless you are pairing: So I
a development team is for all the developers to sit in will pair. I am going to do all the things necessary to
their cubicles, facing their terminals with headphones give you good code.
on and not interacting with each other. Management does not need convincing that they
If you are going to have a team, that team needs want quality.
to be working together, looking at each other, talking The area where management does need
to each other all of the time. So, a fair bit of pairing, I convincing is in understanding that development
think, is very important. teams are not children, which we do by showing
He said that QA should find no bugs, and the them that we are worthy of their trust:
lack of bugs produces pride in workmanship: Management sometimes treats us like we are children
We do not want to treat QA as this group that sweeps because, frankly, in the past, we have acted like
all the bugs back into development. We want to look children. Our room has been messy and the managers
at QA as the people we are going to impress. They are had to come into the room and clean it up too many
going to find nothing. And of course they find things times. Now, maybe, we can begin to act more like
and we should be shattered when that occurs. Oh, my adults.
goodness! How did that bug get out of development all He discussed the importance of small cycles
the way into QA? QA should find nothing. This should and feedback loops in iterations one to two weeks
be our fundamental view of what QA should find. Our long:
level of standard is so high that QA finds nothing and I like one week one week is a nice size. Not a lot of
that leads to pride of workmanship. Are we proud of bad stuff can happen in a week. In two weeks, more
the way we work? This is really what craftsmanship is bad stuff can happen. When you close that feedback
all about at an emotional level. loop is when you have to deal with the bad stuff. We
On the topic of convincing others to take up have learned in our industry that working in short
these ideas, he said: cycles is better than having long development phases.
I have come to the conclusion that there is no way Something else that we have learned is that
to convince others, that the best thing you can do is we can also work in extremely short cycles if we are
to do the best job you possibly can and act as a role practicing test-driven development, because if you are
model. And no matter what else happens, you will do doing test-driven development, you are going around

Technical Debt and Software Craftsmanship // eMag Issue 27 - Apr 2015 9


the test/code/test/code loop once every 30 seconds
or maybe once a minute or so. So, you are getting
feedback all the time. We have learned in the last
decade the importance of very small cycles.
He presented the idea that source code is
the design:
Despite our search for a proper blueprinting
mechanism, despite our search for the
diagramming notation that will solve all software
worries, the real design is in the source code.
There is no design documentation that uses a
diagrammatic notation that is good enough. The
real design of our software lives in the source
code, not in any pretty pictures we might draw.
He ended his talk with a skeptical discussion
of certification. He stated that certification over-
promises and under-delivers in our industry:
Consider what the certification schemes out there
right now have to offer. Come to our course for
four days and we will give you a certificate. What
does that certificate mean? It means that you paid
for a course for four days. Does it mean that you
actually attended the course? It is not clear, but
you did at least pay to attend the course. Maybe
there is some test at the end. It does not really
help anybody that you have this piece of paper....
I think the only people who benefit from it are
the certification bodies, the people collecting the
fees. I do not think the rest of us benefit from a
certification.
He contends that certification does not
help employers select good people and a
certificate does not tell them that:
How do we determine who to hire? Well, I have a
revolutionary idea about this and it is something
that, I dont know, maybe I can bounce it off you.
Maybe, just maybe, when you are thinking about
hiring someone, you should talk to them. Maybe
for an hour. Maybe you should have several
people at your company talk to them. Maybe you
should have them write a little code for you to see
what kind of code they might write. This is not a
guarantee of much, but at least it is something.
Maybe you should have them give you the e-mail
addresses and phone numbers of people they have
worked with and this is really radical maybe
you should check those references.
READ ONLINE ON InfoQ

Creating a Culture of Quality

Jonathan Leveneis a Boston-based executive coach specializing in leadership development


of engineering managers and executives. He is a 14-year veteran of product-development
organizations in small and mid-size companies and has held prior roles in engineering, product
management, sales, marketing, and business development.Jonathan provides engineering
managers and executives with tools and evidence-based training and coaching programs
on leading effective virtual and self-managed teams, influencing leaders in other functions,
and developing technical talent for peak performance. For articles and tools on engineering
leadership, visit his websiteor contact him atjonathan@levenecoaching.com.

Every company wants to delight customers with a high-quality product, and


many engineering organizations naturally focus on process improvements to
reach quality goals. But organizational culture eats strategy and process for
breakfast. So how do you create a culture of quality?
Product quality is one of the areas that engineering of the Martin Trust Center for MIT Entrepreneurship
teams monitor closely throughout the software and a senior lecturer at the MIT Sloan School of
development lifecycle. Most often, a mix of both Management, reminds us, culture eats strategy
external quality measures visible to customers for breakfast and, I argue, process as well. When
such as defects, reliability, or security are tracked organizational culture clashes with the spirit of a
alongside internal quality measures not visible process change such as when a command-and-
to customers such as conformance to a spec, control culture tries to achieve productivity gains
maintainability, efficiency of code, or codebase size. through self-managed, agile teams culture wins
When significant or recurring external/internal quality every time.
improvements are needed, though, engineering Culture manifests itself through an
teams often focus on process improvements as the organizations values, norms, beliefs, and habits and
way to get there. After all, the quality of the product these, in turn, impact product quality by guiding team
is a manifestation of the quality of the process that actions. Im not talking about what an organization
was used to create it, right? says it does, Im talking about what it actually does
Products are manifestations of the culture that - at all levels. To begin with, organizational values
create them, too. As Bill Aulet, managing director typically help prioritize whats most important to

Technical Debt and Software Craftsmanship // eMag Issue 27 - Apr 2015 11


teams. For example, an organization that highly values product management, QA, and engineering
simplicity in design may revert a fix for a defect if it can all agree to.
accidentally adds complexity to the user experience. Make your metrics visible. Pull them out
The overall quality of a release may be assessed by frequently in meetings, and review them in
the elegance of the implementation of new features regular check-ins with your team.
it planned to introduce. Use quality in trade-offs. Create clear
Organizational norms define what is considered definitions and guidelines for minimum
acceptable behavior, typically through an quality levels, and use them in meetings when
organizations track record. An example might include trade-offs need to be made at the end of a
whether past releases required developers to work release. When your team sees quality metrics
extra hours to fix critical defects towards the end of being used in trade-off decision-making,
a release. Without this track record, planning a high- theyll know that quality matters.
quality release would require a project manager to A special note is warranted here about
be over-conservative in estimating team productivity introducing or changing metrics in your organization.
- since a team may not accept putting in the extra As with any change initiative, it is critical to balance
hours to meet a quality commitment. buy-in with mandates to adopt the change. The risk
Organizational beliefs are shared ideas or with metrics is that different teams may begin using
principles about the way things should be. These their own variations that emphasize their interests
might include the belief that developers should over those of others. Since the purpose of metrics is
have ownership of and accountability for the code to measure and shift team behavior across the board,
they write so that their code is reflective of their its critical that all stakeholders (senior leadership,
own diligence and hard work. When major defects product, QA, and engineering) agree and adhere to a
are traced to their code, these developers will feel a common set. You can achieve this if you:
healthy sense of embarrassment from having missed Form a cross-functional working group with
something and will try to resolve it as quickly as purpose. Motivate the need for the metrics by
possible. Contrast this with the behavior resulting clearly identifying the current pain points that
from an organizational belief that every project and exist without them, why action is imperative
every area of enhanced code will have defects now, and how common metrics will help. Invite
and that these should be expected. With this belief, influential stakeholders from across senior
developers will be slower to react when defects are leadership, product, QA, and engineering to
found in their code. design the metrics. Each participant can represent
The last element of culture is organizational their teams interests during discussions, as well as
habits, and these guide the regular and often help sell the metrics internally to others. Choose
unspoken tendencies of the companys teams. One a good facilitator and be sure to explicitly ask
example is the style of making decisions. For some participants to sell the result to their peers after
organizations, decisions require deferring to the most the metrics have been designed.
senior person in the room, while other organizations Measure for outcomes that matter. Ask the
will define and use evidence-based criteria that working group to begin by identifying the
people at any level can apply to support a decision. desired, qualitative product outcomes that
It can be quite instructive to observe how a team different stakeholders expect. Once these
decides whether quality is good enough to release outcomes have been identified, invite the group
since this is perhaps the single most-important to work backwards to select metrics that measure
decision about quality made during a release. movement towards or away from each outcome.
So how do you drive quality through culture? For example, lets say your product is a cloud
In their Harvard Business Review article, Creating application whose computational costs are rising
a Culture of Quality, Ashwin Srinivasan and Bryan faster than adoption and senior management
Kurey of CEB share the results of their recent research is concerned. The working group might identify
on this question. They studied over 850 employees various metrics to measure efficiency, such as
who impact quality in 80 multinationals to find four CPU utilization across servers, which can be
factors that drive quality as a cultural value: tracked during development and testing. Once
1. Leadership emphasis. Managers need to the metrics are finalized and in use, show your
demonstrate how to walk the walk with respect teams what impact they are having.
to quality, and this must come right from the top. Standardize metrics use across teams. Charge
You can do this if you: the working group with creating the templates
Track quality metrics. Define meaningful and dashboards that all teams will use to view
measures of quality that senior leadership, the metrics. Invite each participant to present

12 Technical Debt and Software Craftsmanship // eMag Issue 27 - Apr 2015


the results to their respective teams and ensure 4. Employee ownership and empowerment. You
these are used consistently. Since all functions can empower your team to make quality decisions
had input into the process, set clear expectations and feel greater ownership over the results. To do
that these metrics should be used going forward this, consider the following:
by everyone. Recognize quality initiatives. Create individual
2. Message credibility. Successful managers measures of quality (such as bugs per developer,
carefully choose the right way to communicate perhaps scaled by project complexity) and provide
the quality message based on what resonates with visibility and recognition to those on your team
their teams. This may take some experimentation who get results. Create a dashboard displayed
to get right. Communicate the perspective of prominently for people to see how they stack up
different internal or external stakeholders about against peers. Use this in meetings.
product quality and see what lights your team up. Create competitions. For a big project, consider
Examples might include: awarding prizes to the top performers who
Customer satisfaction. Interview or survey implement the highest-quality code. Be sure to
customers on their overall satisfaction with announce the competition at the outset and
the product, and include quotes to bring their clarify how people will be measured. Have fun
sentiment to life. with it.
Sales experience during demos. As any sales Construct learning opportunities. Invite team
rep will tell you, having the product crash members with the best track records to deliver
during a prospect demo can be very damaging lunch talks on how they approach quality, the
and awkward for the sales rep. Find out how design choices they made, and the outcomes of
sales reps experience the product during recent projects. Encourage team members to show
demos and how reliably they can show it off. links between their approach to quality during a
Perceptions of senior leadership. In many feature implementation and how customers, sales
organizations, senior leaders (especially reps, or senior leaders experienced it.
founders) love to play with new product In my 15 years of engineering and product
capabilities. Invite them to get involved management experience at small and mid-size
towards the tail end of a release and interview software companies, I have found that the two most
them about their experience. powerful approaches to influencing culture are
3. Peer involvement. Your team will internalize creating rituals and recognizing achievements. Rituals
quality once they begin engage each other about have the capacity to powerfully align teams behind
it and you can help encourage this by taking a common practice (forging a team identity), and
various steps: rewarding successful initiatives creates incentives for
Create rituals at design time. During design team members to feel a sense of ownership over their
discussions, help your team develop a routine decisions and focus on what matters most.
to evaluate the quality impact of various design My first startup experience brought this home.
options. Provide questions for the team to I was a junior engineer fresh out of graduate school,
answer for each design being considered, and and our VP of engineering would define phases of our
after a release, show how these contributed to release cycle to control changes made to our source
overall quality. repository. The green phase early on in the release
Invite peer assessments. During periodic status meant that our codebase was open for all manner
meetings, show your team the latest quality of changes, the yellow phase in mid-release meant
metrics and ask each person to make their own that only low-risk changes were accepted, and the
assessment of where you stand. Where is there red phase at the end meant that each change had to
agreement and where do conclusions diverge? be peer-reviewed to meet a certain quality standard.
Regardless of the answer, simply inviting the Looking back, our VP continually broadcast the phase
team to make their own assessment will get we were in (demonstrating a leadership emphasis),
them thinking about quality. and the rituals of peer reviews in the red phase really
Encourage pair programming. If done at helped us internalize a quality-oriented mindset.
regular intervals, particularly between At the end of each release, our VP would also invite
junior and senior developers, this will help peer nominations for high-quality efforts, which
encourage discussions of quality at design wisely reinforced peer involvement while recognizing
and implementation time. Encourage your achievement. The result was a strong sense of team
senior developers to discuss this in each pair- identity and shared values that persist with me to this
programming session. day.

Technical Debt and Software Craftsmanship // eMag Issue 27 - Apr 2015 13


READ ONLINE ON InfoQ

Michael Feathers on
Technical Debt, Process, and Culture

Michael C. Feathers is a member of the technical staff at Groupon. Prior to joining Groupon,
Michael was the chief scientist of Obtiva and a senior consultant with Object Mentor
International. Over the years, Michael has spent a great deal of time helping teams alter design
over time in code bases. Michael is also the author of Working Effectively with Legacy Code
(Prentice Hall, 2004).

At the IEEE Software Experts Summit in 2012, Michael Feathers gave a talk
titled Technical Debt, Process, and Culture in which he presented his ideas on
creating an organizational culture and processes that can enhance software
development and reduce technical debt.
He reminded the audience how Ward Cunningham Quite often now, technical debt is used as a generic
oined the term technical debt to describe a specific term for the type of entropy that we see in software
strategy he had used in decisions about building a development systems. You work on something, and
software product. Feathers explained it as follows: maybe you havent done exactly the best thing you
We have some short-term goal that we need to meet, could and as a result you end up having something
and (we are) basically going to do it in a rather quick which is a little bit sour over time maybe earlier
and dirty way. And once we do this, we are going to technical decisions impede (you) as you are trying
say we have accumulated this particular amount of to add technical features later on, and we see that as
technical debt and thats fine as long as we go back being the result of technical debt.
later and clean this up. He maintains that the definition of technical
Cunningham described this as a specific debt that is most prevalent today is generalized
approach, with emphasis on going back and cleaning entropy in software systems as a result of personal
it up. decision making when we are designing things.
Feathers said that the way the term was treated He proposed taking another view of technical
in 2012 is quite different than Cunninghams original debt as the effect of unavoidable growth and
intent: remnants of inertia inside software systems.

14 Technical Debt and Software Craftsmanship // eMag Issue 27 - Apr 2015


Feathers said that this view of technical debt
makes it something that can be effectively managed ORGANIZATIONS I HAVE SEEN
and addressed through the software development
process. It is something to be avoided where possible
but it is part of the fundamental characteristics of
THAT HAVE NOT KEPT A GOOD
software products.
Building on that understanding of what BOUND ON TEAM SIZE QUITE
technical debt is, he asked, What if the wear and
tear of evolution is normal inside a software system?
Working from that premise, he identified
OFTEN END UP IN A SITUATION
trends in the shape and design of a software system.
Feathers challenged the perception of software as WHERE THE CODE SUFFERS
something that is deliberately designed and built
using a predefined process, asserting instead that
software is more organic and evolutionary in nature.
VERY DRAMATICALLY.
He said that any software system that has been
around for a number of years has characteristics
that are contradictory to the design model of to it having biological-like qualities. So, we should
development. not be surprised by what we see today in software
To illustrate his point, he posed two questions: development.
If you are working on an existing software product, is He went on to explore the similarities between
it easier to add code to an existing method or to add biological systems and software systems in the aspect
a new method? Is it easier to add code to an existing of piecemeal growth new parts of a system (biological
class or to add a new class? or software) do not grow out of nothing but almost
He said that more diligent development always grow from something that is already there. It is
professionals will maintain that it is easier to add always easier to add something on top of an existing
a new method rather than to modify an existing construct than to build something completely new,
one as it allows for better separation of concerns, even if the latter would be a more ideal solution to the
simplification of logic, etc. problem faced.
While Feathers called this the better approach, He used the example of language design,
he pointed out that the reality can be measured by specifically the C++ language. He said that C++ is
looking at existing software products to see what an old and established language that was designed
has actually been done to the codebase. In doing with allegiance to existing structure and concern for
so, we see systems with very large classes, with backwards compatibility:
very large methods systems which just grow and
grow over time despite the
widespread knowledge that
small classes and methods
are generally considered
better design. The average
developer working in a
system will typically go ahead
and add more code to an
existing method rather than
creating a new method and
the same with classes, he
said.
This tends to result in the
organic growth of systems
they grow over time. He said:
We as an industry really
havent adjusted to this reality
all that much, havent really
settled into the notion that it is
our interaction as people with
the software system that leads

Technical Debt and Software Craftsmanship // eMag Issue 27 - Apr 2015 15


(Looking at C++) feels almost as if you are looking at an organic process. If they arent, they will quite often
a tree or something like that. The fundamental design be sideswiped by unintended consequences.
decisions that were made early on plus that allegiance A corollary to Conways law is what Feathers
to previous structure, to previous design decisions, has called the tragedy of the commons.
led to an increasing amount of complexity over time. The perception that adding more and
This complexity does not grow uniformly but more people to a team can accelerate software
comes in waves and at different times in different development is something that he maintained is a
parts of the system: potential risk of agile development. Despite Brookss
When you look at something like the design of the C++ Law (http://www.techopedia.com/definition/18085/
language, (you find) that some things are not quite as brooks-law), there is a temptation to create larger
simple as they could have been, and thats a natural and larger teams (possibly split into sub-teams) but
consequence of having to deal with previous design this brings risk to the quality of the codebase:
decisions. Organizations I have seen that have not kept a good
He said that this happens in most software bound on team size quite often end up in a situation
systems it costs too much to remove pieces made where the code suffers very dramatically. It comes
in response to previous design decisions. We make down to the fact that anybody can come in and touch
decisions in the context of what is already there, any part of the code that they want to. It still amazes
which results in complexity that would otherwise me that people attempt to staff very large projects with
not be necessary. scads and scads of people and believe that is going to
Feathers said piecemeal growth biases toward be okay and that everything is going to scale nicely. It
the existing structure of the system. Maybe. just doesnt happen that way.
He explained the maybe in reference to Another corollary to Conways law he identified
the strong push over the last decade towards was process shapes software, too: any organization
iterative development. The recognition that big, that uses a process will inevitably produce artifacts
up-front design approaches do not work well and with grain mirroring the period of the process.
the consequent influence of the agile software- One potential impact of this is that highly
development movement have led more and more iterative projects run the risk of accelerated entropy
organizations to adopt iterative development in the software. He indicated that this is an intuitive
practices. He reminded the audience that iterative rather than empirical statement and that research
models of development are not new; they have been needs to examine it.
around since the early days of software development Feathers also tied interface bulge to Conways
but the degree to which they are being adopted is law.
unprecedented and becoming universal.While In large software projects, we could have
acknowledging that he did not have conclusive multiple teams working on different parts of the
evidence, he said that it appears that the widespread system, and those teams are defining components
adoption of iterative models can help reduce the with interfaces between them. Right behind the
bias towards organic growth in systems. API, there is often a place of accelerated change and
He continued with a discussion of the different complexity. He indicated that this is a result of how
forces that act on software and influence the hard it is to change the interface between teams;
structure of systems. Software development is not instead of changing the interface, there is a tendency
a mechanistic set of activities but a creative activity to add workarounds to the code behind the interface
influenced by a complex set of factors. in order to avoid API change. This adds complexity
on either side of the interface, which is beyond the
Conways Law general characteristics of the overall codebase. This,
http://www.thoughtworks.com/insights/blog/ too, is an area that Feathers suggested for further
demystifying-conways-law study, and is something that needs to be considered
Conways law indicates that the structure of the carefully when structuring teams and software
team impacts the structure of the software system systems.
produced by the team. Feathers said that this is not In considering how software structure impacts
unique to software systems but is reflected in most process, Feathers referenced Peter Provosts talk on
knowledge-based products. He pointed out the the butterfly effect (http://conferences.agilealliance.
implication of Conways law: org/sessions/20106353), in which Provost showed
When staffing projects in IT, organizations should an organization, which may be building safety-
be looking at what the architecture will be and at critical software, should have rigorous processes for
the impact of having particular groups of people on checking in code with code reviews and other quality-
particular areas and should treat the entire thing as assurance activities. The unintended consequence

16 Technical Debt and Software Craftsmanship // eMag Issue 27 - Apr 2015


He showed a graph (Figure 1) of the size of a
single method over time. Working on the basis that
the number of lines of code in a method is a simple
analogy for the complexity of that method, we can
examine the impact of such things as organizational
restructures or other drivers of change.
Feathers presented examples of the aspects
such as cadence of inter-commit intervals across
team members, complexity count across methods,
and what he calls ownership effect, and indicated
that there is an opportunity for further study into the
behaviors and practices of team members and the
quality of the system over time. These could allow
us to identify practices that result in more or less
Figure 1 complexity and fragility in the codebase.
Given his experience as a consultant in a
wide range of organizations, Feathers has been
able to identify clear differences in approaches to
of raising the check-in bar is less frequent check- software systems between organizations for which
ins of code, which makes the impact of regression technology is their business versus those who
larger and more expensive. It moves product perceive technology as peripheral to their core
design to favor more monolithic components and business, whether it is or not. Technology-based
significantly reduces the amount of refactoring that organizations tend to understand the cost and value
team members do, which makes the product less of software quality over time whereas the other types
adaptable. of organization easily lose sight of these aspects (or
Feathers then asked, Are there qualitative never consider them in the first place). Feathers said:
differences in exquisitely designed systems? It seems that banks and insurance companies tend to
He raised this as a question for further study, be relatively high in that area. They tend to think of
and considered the hypothesis that exquisitely themselves as being financial and not really technical,
designed (defined by significant up-front design and as a result there is a schism in communication
effort) systems or parts of systems may well be more between those two halves of the business.
robust: On the other hand, technically focused
Its not that Im not a fan of incremental development organizations face different risks:
I love it, I think its a great thing but I think there It is very easy to get locked in. If you work for somebody
is so much to learn if we discover that certain areas who knows how things were done ten years ago and
of a system might be better if they were designed up hasnt really moved on, you get some entropy in terms
front based upon the structuring side effects that we of skill and acceptance of technical risk.
see within the codebases. He indicated that there is a strong need for
Feathers switched from what he called macro- organizations to more strongly consider the quality
level impacts on software systems to micro-level of the code in their systems as an asset and to actively
factors. manage that asset.
He mentioned research that showed the He discussed the impact of what he called
likelihood a judge would grant parole strong code blindness organizations where senior and
correlated with time of day. A judge is more likely to middle management have absolutely no knowledge
approve parole right after a break, when the judge is or understanding of the actual state of the code on
less distracted, not hungry, more alert, and inclined which their business runs.
to examine all the pros and cons of the case. At other Sometimes organizations target metrics as a
times, judges are less likely to grant parole. way to improve the code quality. Feather warned
Feathers wondered what impact mood, physical of the danger of rampant second-order effects, the
and mental fatigue, hunger, etc. have on the quality unintended consequences of people working to the
of the software we produce. target instead of to the intent behind the goals. He
He presented some metrics that can be used told the story of an organization that set a target of
to track development work and the likely state of increasing the number of tests across a codebase and
the codebase, and discussed how analytics can help how the teams produced many ineffective, difficult-
to expose what is happening in the development to-maintain tests that had no impact on the quality
process. of the product but did meet the numeric target.

Technical Debt and Software Craftsmanship // eMag Issue 27 - Apr 2015 17


The more complex the graph, the more likely
it is that the codebase is complex and difficult to
maintain.
Feathers concept of lifecycle managing holds
that there is a scale point beyond which systems
become unmaintainable:
What I would love to see is people do studies to figure
out at what point in terms of complexity and size are
software pieces about to become unmaintainable,
and then discover if its more economical to rewrite
those pieces at the moment you discover that as
opposed to letting (the code) grow beyond the bounds
of reasonable, financial stability.
He suggested that integrated knowing can
help walk an organization out of code blindness:
Organizations that understand what software really
is for their organization also understand how all
the decisions they make within their organization
Figure 2 impact the structure of their software and also impact
the future directions in which they can take their
business because of the associated costs of the software
He recommended that organizations start to development.
qualitatively assess their codebase. He showed how Feathers concluded that at least one kind of
to use spatial analysis to visualize the complexity of technical debt is unavoidable. The characteristic
the code in a system with some simple graphs that growth of software means that we will get entropy.
were produced by analyzing the links and nodes in a Its just the way things are and we have to get used
codebase. (Figure 2 & 3) to it.

Figure 3

18 Technical Debt and Software Craftsmanship // eMag Issue 27 - Apr 2015


READ ONLINE ON InfoQ

Managing Technical Debt

Sven Johannis working as a software developer for Trifork Amsterdam. Sven is an avid user of
XP practices like pair programming, TDD, and small releases. Currently, hes developing online
assessment software for schools in Switzerland and the Netherlands based on Triforks QTI
engine.

Eberhard Wolffis working as architecture and technology manager for adesso AG in Germany.
His focus is on Java, cloud, and software architecture. He is a regular contributor at international
conferences and author of several books and articles.

Technical debt is widely regarded as a bad thing that should be avoided or


should be paid back as soon as possible.
Should you? We dont think so.

Developers can choose to implement new features with a messy solution delivers the same functionality
in two ways. They can do it quickly and messily, and costs less? Why should they spend money on
which will make future changes very hard. The other automated test coverage? Tests are not features and
way is a clean and smart solution that takes longer therefore dont deliver business value!
to implement but makes future changes easier (see Although messy code or code without tests
the thoughts of Martin Fowler). But why should the works perfectly for customers if it delivers the desired
sponsors of a project accept higher costs for a clean business value, this will lead to an uncontrollable
implementation of a feature that if implemented codebase, extremely specialised developers,

Technical Debt and Software Craftsmanship // eMag Issue 27 - Apr 2015 19


and eventually to an inflexible software product. important requirements does not have to be
Enough messy code may bring a whole engineering absolutely perfect and therefore we dont need to
department to astandstill. spend a lot of effort making it great. So, which parts
In that linked article from 1992, Ward of the code should have high quality? Its possible
Cunningham was the first to use the debt metaphor that a piece of the implementation has a poor design
for technical debt as he explained this problem to but not bad quality if it doesnt require good design,
non-technical stakeholders. Code with low quality but while each particular piece of code doesnt need
and no automatic test coverage can be compared to have good quality, you might be creating an
to financial debt. This code is like a financial burden, unmaintainable system as a whole.
which imposes on all stakeholders - not only on the Understanding strategic design and technical
developers - a debt that incurs interest with time. debt leads to better communication within a project
The principal amount is the cost of refactoring the and therefore to better decisions by its stakeholders.
codebase to a clean design, which allows easy future Developers might realize that not every requirement
changes. The interest is the extra costs, which have has to be implemented elegantly, if this requires
to be paid in the future if the team has to work with a too much effort. The customer understands that
messy codebase instead of a clean one. quick and dirty solutions lead to debt the project
Unlike financial debt, you dont have to pay eventually has to pay back. Technical debt consists
back technical debt. Sometimes, paying it back of hidden quality problems, which like an iceberg
would even be pointless: some pieces of code are might lead to a failure of the project once they
rarely or never read or changed. Therefore technical surface e.g. too many bugs may pop up too late to
debt needs to take into account a probability of fix cost-effectively.
occurrence: how probable and how often will the
messy code be touched in the future? Another Stakeholders of technical debt
difference compared to financial debt is that the Technical debt concerns many stakeholders of a
originators of technical debt wont necessarily software project:
pay back the debt themselves; that is left to the Customers are annoyed by bugs or missing
developers who maintain the codebase later. features due to low productivity.
Like financial debt, technical debt is not This leads to additional costs for thehelp desk,
necessarily to be avoided. Like Eric Allman explains, which annoys the people there, too.
Not all debt (whether technical or financial) is Increased development time and quality issues
bad. Few of us can afford to pay cash for a house, are also a problem formarketing.
and going into debt to buy one is not financially Bugs lead to frequent patches, which annoy
irresponsible, provided that we know how to pay theoperations team.
it back. In contrast, charging up luxury items on a Many annoyed parties definitely dont make
credit card, knowing very well that your paycheck the management happy, especially if there is
wont cover them, is usually a recipe for disaster. bad publicity due to bugs, delays, or security
In software development, technical debt might problems.
lead to early release and profit the organization more Last but not least, thedevelopersalso suffer. No
than it costs to pay back. In finance, debt is a good one wants to deliver bad work. Furthermore, no
thing, if the principal amount plus interest is less one wants to take over the bad work of others.
than the yield of the investment. The same is true
for software. If you sacrifice internal quality for being Technical debt is unavoidable
the first on the market, it only pays off if the yield But why dont projects avoid technical debt from
you make with this decision is greater than it would the start? Assuming that developers arent lazy and
be coming later to the market with better internal are experienced with the relevant technology and
quality. There is, however, a risk, because uncertainty patterns, technical debt almost always arises from
makes it hard to estimate these benefits up front. time pressure. The developers hope to gain higher
short-term productivity and to lower costs with a
Technical debt and strategic design quick and dirty implementation of the current release,
Eric Evanss concept of strategic design gives us an well aware that they will face lower productivity and
idea how to deal with technical debt. He says that higher costs in future releases. The team, however,
a system cant have the same high level of quality can never be really sure that it actually will achieve
throughout. Therefore, a team can choose either to higher productivity or lower costs with the current
leave to chance which parts of the system have good release. Possibly, the shortcuts boomerang earlier
or bad quality or to actively control the quality. Code than expected and the team has to pay the interest
that is rarely read or touched and doesnt implement earlier than expected.

20 Technical Debt and Software Craftsmanship // eMag Issue 27 - Apr 2015


But developers usually dont really want cyclic dependencies. If two elements depend on
shortcuts or compromises in quality. Sometimes, each other, any change in one of the elements
external conditions force them to work quickly on potentially affects the other. These two elements
a release because otherwise there wont be a next can only be changed together although they
release. Or the team assumes that the code wont actually should be separated and be developed
be read or changed often. The previously discussed independently. Furthermore, Structure101 finds
strategic design definitely allows compromises complex code: it is all about the dependencies
in quality. In that case, good code might be gold among the elements. A system is hard to
plating, overkill with little effect. understand and therefore to maintain if its classes
The metaphor of technical debt helps or packages have too many dependencies to
stakeholders to discuss the problem of poor quality other classes or packages. If developers want to
that might otherwise go unnoticed until it is too late. make a change, they have to understand many
The metaphor of technical-debt aptly symbolizes classes and packages and have to consider many
subsequent damage due to bad code quality and the dependencies. These problems point to key
increasing degeneration of quality over time. But the challenges in the architecture.
metaphor also falls a bit short: not all technical debt Code-coverage tools can detect how much
must be repaid. The team also doesnt know exactly code automatic tests really cover. This metric
how much debt has accumulated and when it needs should be used with care since there are no strict
to pay it back. The person who incurs the debt is not guidelines but, generally, coverage of more than
necessarily the one who repays it fancy that in real 90% is a good indicator that there are enough
life! test cases available. Conversely, coverage below
75% may indicate a serious problem.
Identifying technical debt A very bad indicator is frequent problems in
A major problem of technical debt is that its not production. This means that the problems in the
obvious. Anyone can see the amount of debt on an system are so extensive that reliable operation is
account statement. But how can a team recognize no longer possible.
technical debt? What are the indicators? There are also many cases in which systems have
General smells may manifest themselves in technical debt that cannot be measured directly in
statements from team members: the only one the code, e.g. clumsy solutions, the wrong choice
who can ever change this code is Carl; lets just of technology, a well-executed but wrong design
copy and paste this code; if I touch that code for a solution, or simply evil hacks that tools cannot
everything will break; or too many TODO or easily detect. In these cases, technical debt must be
FIXME comments in the code (nicely described measured with general conditions: the number of
by Nico Zazworka). bugs per release rises rapidly, work velocity decreases
Scrum teams have a velocity. The software permanently, or the team is under extreme stress at
system has probably too much technical debt the end of a release.
if the velocity decreases even though neither The sooner debt-incurring problems are solved,
the team nor the external circumstances have the cheaper. If developers identify technical debt
changed. and communicate it, and nothing happens, sooner
Software ages. One indicator for technical debt or later business people will feel these problems, too.
is a system that uses old libraries that are no Technical debt is not a gimmick of developers who
longer maintained or of which new versions are want beautiful code. It is a tangible cost factor and
much more productive (e.g. EJB 2 vs. EJB 3). In may be a risk for a project, and so must be made
the worst case, the libraries are already so old visible and manageable.
that the developers of the libraries no longer As in real life, debt is not necessarily a bad
support them. thing, but it must be used consciously and properly.
Automatically measuring technical debt is For software projects, this means that paying back
partially possible. Correctly configured, tools like technical debt is purely a business decision. It must
Sonar, Sonargraph for Java, or Structure101 find not simply be a developers decision.
important violations of best coding practices.
Asthisblog post shows, this is not the ultimate How to manage technical debt?
solution but is a very good one. With Sonar, Technical debt cannot be ignored, and even the non-
you ensure that developers follow important technical management on the client side must have
code metrics like appropriate class and method an interest in managing it as smartly as possible to
size or low cyclomatic complexity. Tools like achieve the best balance between short-term, mid-
Structure101 find structural problems, including term, and long-term success. What can a team do to

Technical Debt and Software Craftsmanship // eMag Issue 27 - Apr 2015 21


avoid wasting time with unimportant beautification Technical backlog
but still make meaningful business decisions for The technical backlog is an established best practice
improving code quality? to define purely technical work packages. Tasks
Coarse-grained statements such as do nothing for this purpose are created in a task tracker or a
or if the code is unmaintainable anymore, develop requirements management tool. Each task has a brief
anew do not help. description of the technical change to be made, why
Two promising approaches have already proven this technical change is important for the project,
useful in several projects are a technical backlog and and in which part of the code the technical change
including the cost of technical debt in requirements has to be performed. As with any other task, we need
estimates. an estimate of how long it takes to develop a good
Two other critical processes probably make enough solution. In addition, we need to estimate
sense in certain project contexts: buffer tasks for the interest that is inherent in this code. A precise
refactoring and clean-up releases. estimation is difficult but often a rough estimate
of small, medium, or high is sufficient to guide a
Buffer tasks decision. We also need to gauge how likely it is that
The team creates one buffer task per release with, say, this code will be read or changed in the near future.
10% of the available time. Team members can record This approach has several advantages:
time for that task as for unscheduled refactorings; it Technical debt is made visible and clear for
is used for unpredicted problems that might appear everybody. A unanimous decision on if and
in the future. Such a buffer is easy to schedule and when a refactoring task should be done can be
use but also risks wasting that time on unimportant based on the estimated effort and the impact on
work. A buffer doesnt force anyone to consider future code changes.
whether the time is spent for useful refactorings The cost per task is easily tracked.
or not. The developers simply record their time There is no mixture between technical tasks and
on the buffer task. Most likely, the developers may feature tasks.
not optimally use their buffer time especially in However, this approach also has some disadvantages:
deciding which refactorings to do, although that The customer must decide and prioritize tasks
should really be a business decision. Using buffer in the backlog. A customer cannot determine
tasks unfortunately means that what should be done the value of a technical task without detailed
is not really defined. knowledge of the software and technical issues.
In addition, the customer may not really
Clean-up releases understand the business benefit of a purely
Some teams do a purely technical release from time technical task. In many cases, customers may
to time to improve the codebase. This approach not understand why a technical task without a
is only useful if a list of the necessary refactorings feature relevant to them is really needed.
already exists. Otherwise, the team risks wasting Only in special situations should the customer be
time on unimportant refactorings. The business side able to have a final decision with, for example,
must also support this approach because doing it software updates. It is obvious to most customers
might delay new features. Of course, this means that outdated software causes problems. Whether
that business people have to understand technical or not to proceed with an update has to be decided
debt. Teams should think about a pure technical case by case, based on cost, risk, and necessity of
release to clean up the codebase and to rework the upgrade. Updates of components such as the
the architecture if some major effort is needed. For Java Runtime Environment, or an O/R mapper do
example, the same parts of the code might always usually not require a lot of effort and dont risk much
cause problems during development or operations if done regularly. Very expensive changes like the
or the current architecture might no longer fit the replacement of a web framework or a change from a
current requirements. Such problems cannot be relational database to a NoSQL solution must always
solved within small refactorings. A clean-up release have a business reason e.g. the performance or
allows extensive changes. the user experience of an application will improve.
It makes no sense to do a clean-up release after For this purpose, the technical backlog is also well
a hectic and time-critical release that has created a suited. But for such tasks, developers may also
lot of technical debt. At that point, the team has little initiate a separate project, depending on how much
experience with the new codebase so no one can say effort they expect to need.
which part of the code needs to be improved. There If a new codebase requirement should be
is a danger in changing code that does not really implemented in a codebase that is not well designed
need improvement. for this new requirement, a refactoring might be

22 Technical Debt and Software Craftsmanship // eMag Issue 27 - Apr 2015


needed first. To do this, you have to add the extra Only important parts of the code must be
effort for the refactoring during the estimation of the really clean and code should only be refactored
requirement. if necessary. However, it is hard to decide what
Requirements estimation with effort for solution might be best for a specific scenario. Frank
technical debt Buschmanndescribesthree strategies:
Strategic design has taught us that not every Debt repayment: refactor or replace the code,
part of the codebase must be very good only those framework or platform that is considered a
parts whose changeability brings business value technical debt.
or which need to be changed frequently for other Debt conversion: replace the current solution
reasons. The quality of code that is rarely or never with a good-but-not-perfect solution. The new
changed can be ignored and no technical debt will solution has a lower interest rate. That might be a
accrue. good option if a perfect solution is prohibitively
Its also important that code should never be expensive to build.
refactored without good reason. If a new requirement Just pay the interest: live with the code, because
provides concrete business value then we should refactoring is more expensive than working with
never implement this requirement based on badly the not-quite-right code
written code but instead refactor beforehand. That Developers and customers have to decide on the
way, the really important requirements can be basis of cost, risk, and urgency. Such a substantial
brought to a good enough standard. A team that refactoring should always be a business decision.
has been assigned to implement such an important Another important factor for paying interest is the
feature in an upcoming release should have this lifespan of the software: is a refactoring sufficiently
refactoring in the budget and then implement it. valuable if the system will be redeveloped or retired
There are exceptions, discussed in the next section. soon anyway?
This procedure ensures that no unnecessary
beautification work is done and that refactorings Conclusion
are always directly associated with a requirement. Technical debt can be seen as a shortcut that saves
This allows the customer to discuss and prioritize teams time, effort, or money today but that might
the refactoring with the team. The customer can lead to increased costs in the future. Technical debt
also decide whether or not a requirement should cannot really be avoided in software projects. But it is
be implemented based on debt and interest. There not necessarily a bad thing, if handled properly.
might be other factors to take into account, such It is difficult to handle properly, however.
as time to market. The customer might also already The effect bad code has for future requirements is
know about future changes to the code that are difficult or even impossible topredict but completely
based on these requirements and might therefore ignoring technical debt can have a disastrous impact
decide to refactor to a clean codebase in order to on the software. If the team and the customer
save costs in the future. properly handle the risk of technical debt, it should
Problems arise if the team runs into a problem remain manageable, and there are several ways to
with the codebase during the implementation. respond to it. Each of these options should only be
Then the team must decide what to do. If meeting used in a specific context.
the delivery date with all promised functionality It is important to accept that:
is very important, the team must accept the there is always technical debt;
resulting technical debt and interest payments. If all technical debt is not always bad; and
development based on bad code is considered waste technical debt does not have to be (fully) repaid
and there is no real deadline pressure, the team in every case.
should schedule the refactoring and push release to Any repayment should be a business decision. Even
a later date. This all depends on the context and, in if the repayment is so small that a consultation with
particular, the needs of customers. the customer does not make sense, developers must
always ask themselves whether an improvement of
To pay or not to pay? the code justifies the increased time and effort.
One question that must always be addressed in
the discussion of technical debt is should it ever be
repaid?

Technical Debt and Software Craftsmanship // eMag Issue 27 - Apr 2015 23


READ ONLINE ON InfoQ

Technical Debt: A Repayment Plan

Jeremy Jarrellis a professional software developer and agile coach specializing in commercial
application development for the private sector.He is heavily involved in the local developer
community, both as a highly rated speaker throughout the East Coast of the United States as
well as a syndicated author whose articles and videos have appeared on sites such asSimple-
Talk, DZone,Pluralsight, andScrum Alliance. Jeremy loves to discuss all topics related to software
development or agile methodologies and can be reached through Twitter at@jeremyjarrellor
athis website.

Many teams struggle with technical debt but few teams devise a plan to get
out from under it. To better understand how we can escape the debt, we first
have to understand exactly what it is.

Technical debt is incurred by a team that knowingly This means that many things we
makes a less-than-optimal technical decision in commonly attribute to technical
return for a short-term gain in their project. For debt are not actually debt at all.
example, team members may decide to forego For example, normal bit rot that
writing automated tests as in-depth as they occurs as a system ages under a
normally would for a tricky section of code in order team that fails to keep up with
to get a product to market sooner. Or they may coding best practices is not debt. A technical decision
decide to build a project on an aging, soon-to-be- that a team willingly made and implemented that
deprecated framework rather than investing in the later turned out to be incorrect is not technical
purchase of an upgraded, better-supported version debt. In neither case did the team knowingly enter
of that framework. Whatever the decision is, the into a less-than-optimal long-term decision in favor
key to recognizing true technical debt is that the of a short-term gain. This distinction is important
team knowingly (and not accidentally) decides to because only after weve agreed on what exactly
incur long-term debt in favor of a short-term gain. constitutes technical debt can we best decide how
to eliminate it.

24 Technical Debt and Software Craftsmanship // eMag Issue 27 - Apr 2015


Its also important to consider the effect of
debt we unintentionally incur in our codebase, but BIT ROT DIFFERS FROM NORMAL
since we did not intentionally take this debt were
unable to plan how to address it ahead of time. In
these cases, we simply must prioritize and address
TECHNICAL DEBT IN THAT ITS
this debt as we discover it, similar to how a team
addresses newly discovered bugs. NOT TAKEN INTENTIONALLY,
We often compare technical debt to financial
debt, but is this a fair analogy? For example,
would a bank actually lend us money without first
SO WE CANT DECIDE AHEAD
establishing when and how it will be repaid? Likely
not. Since we couldnt actually borrow financial OF TIME HOW AND WHEN TO
capital without first agreeing how to repay it, we
shouldnt treat technical capital in this way either.
The financial metaphor is actually a quite
REPAY IT.
powerful one, so lets take it to its full extent.

A repayment plan
Like financial debt, when taking on technical debt, add test coverage to those areas while deferring the
we need to establish how and when it will be repaid. simpler areas for later. Or they may decide that simpler
but lower value types of automated testing such as unit
How well repay it tests can be added immediately while setting aside
Lets take the case of the foregone automated tests more difficult automated tests such as automated
mentioned above. If our team has willingly decided user-acceptance tests for a future sprint. Whatever the
to forego writing automated tests for a tricky piece decision, the team and stakeholders would likely not
of code in order to get a feature into production have arrived at it had the discussion of technical debt
sooner, then we need to establish how well correct not occurred in the first place.
that piece of debt. In this case, we simply need to
state that well return to this piece of code at some When well repay it
point in the future and add the tests then. In addition to howwell repay the debt, well also want
However, simply stating well add tests later specify whenwell repay it. Often, the sooner the debt
doesnt do this problem justice. To help stakeholders is repaid, the better. For this reason, its best to schedule
fully appreciate the weight of our decision to incur
technical debt, well need to specify, to the best of
our abilities, exactly what the impact of waiting to
add automated tests until later will be. For example,
well want to specify the sections of code for which
we will need to add tests. Well also need to point
out that retrofitting automated tests on an already-
existing piece of code is always more difficult and
expensive than simply adding the tests at the time
of creation. This last point is important because it
highlights that in deferring this work to the future,
well actually need to spend more money to do the
work then than if we had we done it today. To put it
another way, our debt accrues interest.
After discussing the options for repayment,
both a team and its stakeholders will likely realize
that this problem goes deeper than simply whether
or not they should write automated tests at the time
the code is written. In fact, they may find that they
have several options between the two extremes
that suit the overall project better. For example, they
may decide that it makes the most sense to identify
the most complex pieces of the new feature with a
metric like cyclomatic complexityand immediately

Technical Debt and Software Craftsmanship // eMag Issue 27 - Apr 2015 25


the work to repay the debt at the time its incurred system maintenance that make themselves known
to better convey the impact of taking it on. For as our codebase naturally ages and decays.
example, if your team is following a sprint-driven But what about the larger issues that cant
schedule then you may choose to schedule the work be handled in a few hours of development time?
for the following sprint or, in the worst case, a few Perhaps there are more systemic problems plaguing
sprints in the future. our system such as a failing infrastructure or an
Often, a team has the best intentions of aging architecture that no longer fits the shape
repaying debt at the time its incurred but just never of our business. While these issues are too large
seems to find the time to do so. Get your repayment to easily address, we can use this buffer to identify
deadline on the calendar when you take out your and investigate these issues so we can give them
debt and stick to it. the attention they truly deserve later in the project.
For example, in the case of failing infrastructure,
What happens if we default? perhaps we could identify the most common failing
The final piece of our financial metaphor is to pieces and add stories to our backlog to replace
capture the result of defaulting on our debt. In the those pieces. Well then prioritize and schedule those
financial sense, if I never repay my auto loan then the stories alongside our normal development. In the
bank takes my car. The results of defaulting on our case of the aging architecture, we may spend time
technical debt should be laid out just as clearly. to determine the highest value in-flight changes
Sticking with our example of automated tests, if that we can make to our architecture and then break
our team decides not to repay our technical debt, it those changes into stories that can be addressed
will only become more difficult and more expensive piecewise over the coming sprints. Regardless of the
to build new functionality on top of the existing, problem, having the time to identify and plan for
untested functionality. Well likely see more bugs the issue means that we can address it like any other
reported in production, which may diminish the technical problem.
impression our customers have of the quality of our
product. And well be less able to rapidly respond to A budget
changes in the marketplace because a significant Now that we better understand
portion of our product will be either too difficult or the effects of incurring technical
too risky to change quickly. debt, how do we make sure
We need to make each of these points clear to we pay it back? To get a feel
our stakeholders to help stave off the temptation to for this, we can expand our
simply default on our technical debt. financial metaphor in yet another
direction: budgeting.
Dealing with bit rot Many of us draw a regular paycheck every few
While this discussion so far has weeks. This paycheck is a portion of our annual salary,
centered on planned technical distributed in even portions throughout the year.
debt that teams knowingly incur For example, if we draw an annual salary of $52,000
as part a normal project, we then we may receive that salary in $2,000 increments
would be remiss if we did not every two weeks, or 26 times per year.
discuss theunplanned technical However, while we receive $2,000 dollars every
debt that also plagues so many paycheck, its quite unlikely that the full amount
of our projects: bit rot. makes into our checking account. Its more likely that
Bit rot differs from normal technical debt in that its only a portion makes it to our checking account while
not taken intentionally, so we cant decide ahead we use the rest of it for long-term investments or to
of time how and when to repay it. However, not pay down debt. For example, a budget breakdown of
knowing specifically what form bit rot will take on $2,000 may look like this:
our project doesnt mean that we cant still plan for it. $500 invested for the long term, such as
Just as we plan to pay back known technical contributions to our retirement account;
debt, we can build into our project plan a buffer with $200 used to pay down short-term debt, such as
which to address bit rot during each sprint. Though credit cards;
the specific tasks that fill this buffer may not be $300 used to pay down long-term debt, such as
known at the time, having the buffer there gives us a a mortgage or auto loan;
dedicated space with which we can pay back those $250 deducted directly to pay local or national
unplanned issues such as bugs, minor refactorings taxes; and
that must be handled immediately, or small pieces of the remaining $750 deposited into our checking
account.

26 Technical Debt and Software Craftsmanship // eMag Issue 27 - Apr 2015


While no one is particularly
thrilled about this arrangement,
few people question it. Its
simply the accepted norm. If
this arrangement is so widely
accepted, why not extend it to our
project planning?
Imagine that were planning
a sprint in story points and weve
allotted 50 points to that sprint.
While wed like to spend all 50
points on new development, it
makes the more sense to budget
some points to pay back our
technical debt. For example, of
our original 50 points we may
decide to budget:
10 points to pay back
technical debt;
5 points to ongoing codebase
maintenance such as fixing
bugs or addressing bit rot;
and Of course, like our personal budgets, this
35 points for new development. budget does have some leeway. For example, if we
Looking at our point budget, we see some obvious pay down our technical debt more quickly than
similarities to the financial budget described above. expected then were left with more points to spend
We cant spend all 50 points on new development. on new feature development. By the same token,
Rather, we must commit 10 points towards paying if we find ourselves taking on a particularly large
back our intentionally incurred technical debt, just amount of technical debt then we may need to slow
as we commit a portion of our paycheck to pay back new feature development a bit until its back to a
long-term and short-term financial debt. In addition, more manageable amount.
we devote 5 points for ongoing maintenance of our
codebase, just as we lose a portion of each paycheck Wrapping up
as taxes that help keep our communities running By thinking of technical debt in terms of financial
smoothly. The remaining points are ours to spend on debt, we can make more informed judgments of
any new development we like, just as the remaining when to incur debt for the betterment of our project.
dollars deposited into our checking account are ours We can also better plan the impact of trying to pay
to spend as we wish. the debt back as our project progresses.
By budgeting our work in this manner, we can And by planning a regular budget for technical
ensure that we move the project forward without debt alongside our regular work, we can better
allowing it to crumble under the weight of our understand when our debt is manageable and when
technical debt. its becoming overwhelming.

Technical Debt and Software Craftsmanship // eMag Issue 27 - Apr 2015 27


READ ONLINE ON InfoQ

James Grenning on Technical Excellence

byShane Hastie
James Grenning, founder of Wingman Software, trains, coaches, and consults worldwide.
With more than 30 years of software development experience, both technical and managerial,
James brings a wealth of knowledge, skill, and creativity to software development teams and
their management. As his professional roots are in embedded software, he is leading the way to
introduce agile development practices to that challenging world. See James articles for applying
Agile to embedded software development. Areas of interest are software process improvement,
object-oriented design, programming, embedded systems, project management, extreme
programming, test-driven development, test automation, and agile software development.
James knows his way around Scrum, with ScrumMaster and Product Owner certifications.

James Grenningis the founder ofWingman Software, author ofTest-Driven


Development for Embedded C, signatory of the Agile Manifesto and inventor
of planning poker (which he now advises people not to use). He delivers
training and coaching in technical practices around the world. At the Agile
Singapore2014 conference, he presented two technically focused talks - one
on the importance of technical excellence and the other a hands-on workshop
that taught the skills of test-driven development (TDD). He spoke to InfoQ
about the importance of strong technical practices to enable true agility in
software development.

something that I call debug-later programming:


Youve come to the Agile Singapore conference
you write some code and you figure out whats wrong
and youre talking on technical excellence. Whats
with it later. You usually find some of the problems
the extent of technical excellence in software
but not all of them, and it leads to big problems in
development today?
delivery and later. A lot has changed since 1979; in
1999, I discovered extreme programming and it
In my travels, I visit a lot of companies and I find changed my world from a reactive life of debug-later
people programming the way I learned in 1979, programming to a proactive life of TDD where I can

28 Technical Debt and Software Craftsmanship // eMag Issue 27 - Apr 2015


prevent defects. I was invited to give this talk here in work through manual testing, but they dont think
Singapore and I had some specific messages for the about that. They think about how many lines of code
attendees. I wanted managers to understand that were writing and it must mean that is going to take
defects are the result of the way we work; it causes us way longer.
the problems they are experiencing defects being
found late and in the field. I wanted developers to
understand why these practices are important.
Theyre not important because theyre written down But surely were beyond lines of code as a metric.
in a book. Theyre important because they solve Surely the work is the creative output of the
specific problems. As an engineer Im interested in thinking process?
solving those problems and helping other people
solve them.
About lines of code people still see it that way, until
they experience it. One thing I cant do for someone
is experience how much better they will be in several
Weve known about these practices since at least weeks or months if they learn this. I cant make them
1999 if not before. Why are they not just the way experience that because these approaches have to
we do work now? be voluntary. For someone to get the benefit from
TDD, they need to see that is might solve a problem
they want to solve. If they try it, they are likely to
I dont know the answer to that but Ive got some convince themselves through their own experiences.
suspicions. Work life is very demanding when you Of the experienced people that started
work for a big company and there are a lot of ideas learning this years ago, most of them wouldnt stop
out there fighting for your attention. Its hard to and its not because they want to be slower, less
know what the good ones are. People know what effective developers. Its because they want to be
they know, and they dont necessarily know what more effective. Though youve got to take the time
they dont know. So if you hear about something like to learn.That often means picking the right time to
TDD, you form a vision of what that is in your mind. start.
It sounds strange, people forming opinions with
little information. You dont know what to do with
it so you keep doing what you know. The pressure
is on, and its hard to find time and support for the Agile has been around since you and others
change that you might want to do. The organization created the Agile Manifesto in 2001. One of the
makes it hard for you to change, and you dont really underlying principles is technical excellence. How
understand what it is and why it would be important. effective has the agile community been at getting
Most people are doing the best that they know but that message through?
they dont know what they dont know.
Its interesting. On the tenth anniversary of the Agile
Manifesto, Alistair Cockburn held another meeting
to which he invited the original people involved
How come weve done so poorly at getting this in the manifesto as well as other influencers in the
into the programmer education in the university community. It was in Utah, so I am in. The reason I
system, educational system, and organizational was in the manifesto group to start with is that Bob
training systems, because these good technical Martin invited me and it was in Utah and ski season.
practices can actually save organizations lots of This was an easy choice for me. Obviously, Im going
money? to go to Utah to go skiing. The second meeting was
a retrospective on agile and again it was in the right
Yes. Thats my experience and belief as well, that place and hanging out with cool people again.
the practices of extreme programming save people The retrospective on the state of agile resulted
money. First off, it appears that they cost more in four bullet points surprise. Unlike the original
because people are concerned about the lines of meeting, four bullet points was an objective of the
code that need to be written. When I teach people tenth anniversary meeting. The top two bullet points
how to start doing TDD, the first simple exercise were very important to me. The first was that we need
results in writing 100 lines of code and 150 lines of to demand technical excellence. The second bullet
test code. We spend less time than it would take point was that we have to help foster change. The
someone to write production code and get that to other two I dont remember. The first two surfaced

Technical Debt and Software Craftsmanship // eMag Issue 27 - Apr 2015 29


on many fronts in the workshop. It was pretty clear programming. (See a comparison of debug-later
that the attendees think the industry has adopted programming and TDDhere.)
the business practices of agile, but not the more
difficult technical practice of agile.
The genesis of this talk came from an invitation
to do a keynote at the London Scrum gathering a few If one looks at the Scrum framework, the
years ago. When the organizers invited me, I asked, retrospective is an absolutely imperative part.
Well, Im not really part of Scrum. Why do you want I will say in my experience its horrifying the
me to talk there? number of teams for whom the retrospective is
Because youre not part of Scrum, they Groundhog Day. They say the same thing again
answered. I asked who would be the audience. and again but nothing changes.
ScrumMasters mostly.
It has been a concern of mine that Scrum Right. If there are numerous things that are wrong
seems to be practiced by the book. The continuous and they all seem out of the teams control, its
improvement intended by the creators of Scrum was hard to make any progress. Fortunately, there are
not really happening across the industry. I asked, Can solutions to many of the problems that the Scrum
I talk about this things that the Scrum community is teams continue to seek for instance, not being able
not doing? They said that would be great, so began to deliver software every iteration. (I dont call them
this talk. I probably should write something about sprints; I think its the wrong metaphor.)
this, too. Ive been talking about it now at a few Failure to be able to deliver every iteration
conferences; its a fun story for me to tell with about is failure of defect prevention. If you dont have
a million sides. automated tests, the cost of retesting will be high,
making releasable product increments very risky.
The cost of retest must be low to be able to do
effective releases every two weeks. The cost of retest
So whats wrong with the Scrum and other agile needs to be close to zero. TDD and acceptance-test-
methods that were just not getting? Whats driven development are solutions to that problem.
missing? It turns out theyre hard to learn, which is very nice
to me because its a fun business. But theyre hard
to learn and it requires discipline and there will be
I think theres something going in. People go to the mistakes until you figure it out and get addicted to
two-day ScrumMaster class. Now, theyre certified this improved way to program.
and they go and practice just what was taught. When
theyre challenged, they say, Well, the books says to
do it like this. People get used to saying, Well, the
book says to do it like this, and they miss the part Why is it so hard to learn? The people were talking
which is Now look at your work and decide whats about here are technical, theyre programmers,
broken and try to fix it. theyre natural problem solvers. They want to do
I was in the first-ever Scrum training class, given this.
publicly by Ken Schwaber in 2002 at Object Mentor in
the Chicago suburbs, and the original materials had Im no cognition expert or anything, but the way that
the extreme programming practices. I discovered people learn to program is a unique thing. I know
they were later removed. I think Kens expectations for me it was: heres how you set a variable; heres an
were that people would go find XP or other technical if statement; heres a for loop. Now go figure out
solutions as part of the retrospectives of Scrum. We how to write an operating system or how to simulate
didnt want to prescribe that as part of Scrum, is what Newtons methods for calculating the area of a curve.
I remember Ken saying (I could have this wrong). Go figure it out.
What I see is people arent doing that part of Scrum. No one was really taught to program. Everyones
Scrum, at its code, is intended to be a continuous programming is a very personal thing, although
improvement cycle. most people generally do what I call debug-later
In the 80s, there was TQM, total quality management, programming. Write the code and figure out whats
where we learned the PDCA cycle: plan, do, check, wrong with it later. With the entrance of TDD, youre
and act. And what I feel is happening in Scrum in turning the whole programming model upside
many implementations is not the whole cycle, just down. You create one behavior at a time, thinking
the act part. Theyre doing the easy part of Scrum about what you want the code to do. Express one
and programming the same old way, debug-later small code behavior in a test, one test at a time. Then

30 Technical Debt and Software Craftsmanship // eMag Issue 27 - Apr 2015


you evolve the code to do just that
behavior. Then choose the next
behavior, and express that in a test.
I can work in a tight feedback loop
that catches my mistakes so that
I can prevent many defects. I also
produce a regression test suite as a
side effect, virtually for free.
Bob Martin compares TDD
to double-entry accounting.
Theres always one credit and one
debit. They cancel each other out
when the books are right. This
is a very specific technique for
programming but very foreign
because its not what people
know. People will generally look
with suspicion at things that they
dont know. Oh. Thats too weird.
No, I dont do it that way.
What I try to do to get some
buy-in, though, is before I even
start with saying anything about TDD, I ask the class you could do more of what you like and less of
attendees at my training to tell me what they like what you dont like? Lets reduce boring manual tests
about development, what they dont like about and trade them for something fun: problem solving.
development, and why theyre at the training class. I The problem to solve is the challenge of writing the
get some interesting feedback. I started to put these test so that I dont have to do boring manual tests
on my website. afterwards. Ive found this to help to open minds to
The activities that engineers usually put in the the possibility that there is a better way.
like category are I like problem solving, I like to I find that more people try to learn TDD when
code, I like to clean code, I like to design, I like they see the possibility that their lives could be
to solve a problem for a customer, I like to see my better. I had this weird idea in the beginning in 1999
work used to solve a problem in the real world. This about people adopting the engineering practices of
is what engineering is all about. I can confirm that I extreme programming. The people I worked with at
have the right people in this room for my training. Bob Martins company were convinced XP was loaded
If engineers tell me they dont like testing, I say, with good techniques and ideas. We thought these
Now, wait a second. Remember, the class is test- ideas were so good that we can just mention them
driven development. Im going to go check to see and people will want to do them. Unfortunately, its
what you answered about why youre here. I bet your not the case.
boss made you come. I mean, the techniques are better but telling
If youre interested to see some of the answers someone about a better idea does not make them
for yourself, you can find recent like and dislike want to do it. For wider adoption, people have to want
replies at Wingman Software.I dont like testing to avoid the problems like debug-later programming
either; traditional testing is boring and repetitive. Its and degraded designs. They have to accept there are
unfortunate TDD has the word test in it because its problems and then see that technical practices of
not the focus. Other things trainees dont like are bad extreme programming may be part of the solution.
code, unrealistic expectations, many of the things Then they have to prove it to themselves.
agile and TDD are supposed to help with.
I use this to get buy-in to try TDD during the
training. Ill ask, What if I by the end of this training

Technical Debt and Software Craftsmanship // eMag Issue 27 - Apr 2015 31


PREVIOUS ISSUES

25
Next Generation HTML5
and JavaScript

Modern web developers have to juggle more constraints


than ever before; standing still is not an option. We must
drive forward and this eMag is a guide to getting on the
right track. Well hear from developers in the trenches
building some of the most advanced web applications
and how to apply what theyve learned to our own
work.

Mobile - Recently New

24
Technology and Already a
Commodity?

26 QCon London
2015 Report
This eMag discusses some familiar and some not too
familiar development approaches and hopefully will
give you a helping hand while defining the technology
stack for your next mobile application.

23
This eMag provides a round-up of what we and some of our DevOps Toolchain
attendees felt were the most important sessions from QCon For Beginners
London 2015 including Microservices, Containers, Conways
Law, and properly implementing agile practises.

This eMag aims at providing an overview of an example


set of tools that would constitute a typical toolchain.
These are popular tools today, but you should look at
them as illustrations of the kind of tasks and workflows
you might need to perform in your organization as you
move along a DevOps path.

Вам также может понравиться