Skip to content

Stories From The Battlefield: #2 - My God, It's Full Of Bugs!

December 12, 2008 by Janusz Marcin Gorycki

Photo (c) Janusz Gorycki

The Bet

Let's bet: I will buy you one pint of beer for every minute it takes me to find an embarrassing bug in your code.

Admit it, you have no chance of winning this bet. Ever. Finding bugs in somebody else's code is dead easy. Preventing them is next to impossible. Well, on second thought, scratch the "next to" part.

There is this user story acceptance criteria of "No known bugs should exist" - yeah, right. If you are a Project Manager (agile or otherwise) and your developers tell you they produce bug-less code, and that they do enough testing to be sure their code is healthy, they are either delusional, or are liars - I don't know which is worse. If you have a consultant who claims that they have a cure for bugs and will make your projects clean and shapey, do yourself a favor and fire him. Or better yet, do everybody else a favor and shoot him on the spot. The world will be a better place.

The Rant

Which brings me to the subject of this post - bugs. The most fundamental, yet easily forgotten fact of life is that all software sucks. All software has bugs. If yours does not, then it means only one thing - nobody uses it. Some of the best software I have ever seen has so many bugs that they overflow their bug trackers' bug counters. And you know what? It is actually a good thing! The existence of bug reports means somebody is using the software and actually cares to report back to you that he is having a problem with it, instead of just deleting it from their hard disk.

We had been working on this user story lately, that has been with us for quite a few iterations and refused to be "done". The story involves a dialog box, that is a bit, well, "legacy" (code word for "crap"). We were supposed to refactor it to stop being broken and that was pretty much the whole story's definition - don't you just love to work on stuff like this? Every time we thought we had finished the story, on the last day of the iteration, somebody managed to find yet another bug in this dialog. And then our ScrumMaster, who loves the agile process to be "pure", would move the story from "done" to "not done" - and we would all be pissed off. Eventually, using my Product Owner Proxy superpowers, I have decided to stop this silliness. I said to the guy - "look mate, this story, in its current shape, is good enough for me, good enough for the Product Owner, and definitely good enough for the general public. I know it still has bugs, but I want it to be released, as not releasing it hurts us more than having to deal with its remaining bugs. We will deal with remaining bugs by filing them in the bug tracker and dispositioning in due time".

So now what?

Ok, so now that we have acknowledged the existence of bugs, what can we do about them?

Quite a few strategies exist. "Pure" Scrum says that you should estimate and prioritize bugs in the same way you size and estimate stories. Bug there is a significant problem with this approach - most non-trivial bugs (and these are the interesting ones) are very hard to size. Once you scratch the surface of some problem, you seem to be opening a can of worms: "oh my God, this thing is broken beyond repair"! Admit it - you feel like this sometimes, don't you? This is not surprising - bug resolution requires a "discovery" phase, which pretty much does not have any upper time bounds.

So what we do about bugs in our team is we do not estimate their size. We simply assign a fixed part of each iteration (say - 1 "man-week") to fixing as many bugs as possible. The story-to-bug proportion is not fixed - we adjust it as we go, based on our gut feeling about the current health of the project.

This is by no means the only valid approach - it is just the one that seems to be working for us. I am interested to hear what other teams do about bugs. Why don't you share your experiences? But please, don't tell us that you don't have the "bug problem" in your project - because nobody will believe you.

AttachmentSize
katedra-male.jpg42.34 KB

About the Author: Janusz is a software developer and team manager with over 15 years of experience. He has been working for a long time for multi-national corporations, mainly in the telecommunication and embedded systems industries, He is now a co-owner of SPARTEZ - an independent agile consulting and software development company

Comments

I don't know if this applies

December 12, 2008 by Kurt Häusler (not verified), 30 weeks 4 days ago
Comment id: 2104

I don't know if this applies to your case, but focusing on bugs as the problem is part of a typical testing/bug-fixing cycle of quality management, leads to the situation you described. When you mentioned scratching the surface of the problem uncovering a can of worms, it lead me to think this case applies to the typical situation that I come across when dealing with software quality issues.

Often bugs are not the problem, they are a helpful indicator of a deeper problem. Usually that problem is some form of technical debt, usually poor software design. Fixing bugs in this case is like putting a bandage over a deep infection. Sure, the customer doesn't see it any more, the tests may pass, but the problem is still lurking underneath. Often bug fixes make the problem worse by building another layer over an unstable foundation. At best they prevent the true problem from being discovered as easily in some other situation. Each time you fix one of these bugs, you are actually paying interest on technical debt. Sometimes that's cheaper than paying back the principle, but usually it is not.

Instead of putting the surface indicators of the issue (the bugs) in your backlog, try to identify the specific technical debt that needs to be paid off (and the interest it costs) and put that in the backlog.

The problem lies with quality management processes left over from waterfall. Testing and bug-fixing, repeat as necessary. Testing (and I am not talking about testing as in test driven development here, as that is more about design than testing, but I do include unit tests) is a fairly superficial activity that has more to do with whether the software meets requirements without crashing or displaying inappropriate or unexpected error messages. It doesn't actually say anything about the quality of the software itself. (Testing only covers a couple of the ISO 9126 defined aspects of Software Quality) Bug-fixing too is an approach that focuses on getting the tests to pass, rather than improving the actual quality of the software.

Software quality is mostly about good software design, and, until recently, mostly considered, a technical issue for the developers, something out of the hands of project managers. However as agile has changed the role of developers into becoming craftsmen and having more responsibility for planning and organizing the development, quality managers (or project managers in general) are also finding they have to become craftsmen too, and take more responsibility for software quality beyond the old testing/bug-fixing cycle, primarily by becoming managers of technical debt.

Bullshit

December 12, 2008 by pbielicki, 30 weeks 4 days ago
Comment id: 2105

@Kurt Häusler
> Fixing bugs in this case is like putting a bandage over a deep infection. Sure, the customer doesn't see it any more, the tests may pass, but the problem is still lurking underneath. Often bug fixes make the problem worse by building another layer over an unstable foundation. At best they prevent the true problem from being discovered as easily in some other situation.

I assume you have never ever been a developer because you're just writing bullshit. If you have a perfectly shining and f***g awesome design you can have tons of bugs because e.g. you forgot to invoke some method or just wrote 0 instead of 1 in your loop.

Bugs are everywhere - whether your design is OK or not

Stop the line

December 12, 2008 by Ilja Preuss (not verified), 30 weeks 4 days ago
Comment id: 2106

I prefer an approach to bug fixing that doesn't assign a fixed (upper) amount of time to bug fixing. Instead, fix bugs as soon as you know about them - and do a root cause analysis how it got out into the wild in the first place, and what you will do to prevent similar bugs escaping in the future. Don't schedule stories for this, just do it as part of the infrastructure work. Yesterday's Wheather will take care of how much time to plan for this. (And this doesn't have to stop you from shipping a feature.)

I've heard of teams who get down to having a handful of bugs report *per year* - and that's not because the software wasn't used. And there is this story of Toyota (who invented this Lean technique, as far as I know), who took over a plant in the US - it took them a month to produce their first car, because they had to stop the line so often to fix small problems. After that month, they were the most productive plant in the whole US.

Cars != software

December 13, 2008 by Janusz Gorycki, 30 weeks 3 days ago
Comment id: 2108

Sorry, but cars are not software. Toyota is a fine manufacturer, but they are just that - a manufacturer who managed to achieve splendid quality. You don't "manufacture" software, you create it - I have a long rant coming on this very subject. And as far as design goes, Toyota cars are average at best, with bugs aplenty in their design. And if you think that Toyouta releases flawless cars into the wild, just talk to my car dealer - they have long list of well known problems in Toyota's cars and are trying to fix them as well as they can. Some of the problems go deep into the root of the design and fixing them requires expensive engine overhaul.

Re: Bullshit

December 13, 2008 by Janusz Gorycki, 30 weeks 3 days ago
Comment id: 2109

It is not just that developers will make simple errors like you described (which they will, as they are mostly sloppy bastards like myself). It is also that for a typical project, you don't really have a luxury of starting from scratch. Or overhauling the existing design. Most software projects I know are supposed to add a feature here or there to an existing software - which is typically a heap of crap of a huge size and 20 years of legacy.

Bugs as an indicator of something more important

December 14, 2008 by Wojciech Seliga (not verified), 30 weeks 2 days ago
Comment id: 2110

@Kurt: I tend to agree with you.


Often bugs are not the problem, they are a helpful indicator of a deeper problem.

My experience confirms this statement. If you have too many bugs, often relating to the same part of your application (e.g. regressions after subsequent releases), it's for me a strong signal that your app design is broken. Not necessarily due to lack of your programmers' skills, but maybe due to new requirements which made current design (left unrefactored) just obsolete.
Having zero bug reports indeed suggests that probably nobody uses your app or nobody cares (both are the signals to abort further development of it). Having many new feature requests or improvement requests with only a relatively small portion of bug reports is IMO the best bug-tracker related metric telling you that your app is in healthy state.
Having more bug reports than new feature requests suggests it's time to take a deeper look on your app's design and start paying technical debt.

I participated a few years ago in a project were thousands of person hours were spent on putting a bandage over a deeper injection. Instead of starting serious refactoring of the system asap, all developers were made by the top management to fix the bugs without touching the core of design. Most of such bug-fixing is long-term anyway pointless, as they are typically fragile and usually resurface soon or cause even worse harm due to unforeseen side-effect (another good signal of bad design of your system) with another bug-fixes or features.
So for me concentrating on bug-fixing is always a failure in long term, however is very tempting as far as shorter horizon is concerned. It is like a dead-march.

So I would say, that instead of devoting fix portion of your iteration to bug-fixing, I would devote such portion to refactoring with concrete goals - e.g. to fix given bug. Not by applying another "if" here and there (another common signal for broken design is when your bug-fixes are often about adding "if" statements - e.g. to avoid NPEs), but rather make your design solid enough so that those if-s are not longer necessary (e.g. they are "abstracted away").

My 2 cents.

Wojtek

missing the point...

December 14, 2008 by Janusz Gorycki, 30 weeks 2 days ago
Comment id: 2111

I guess I am a lousy writer, because you guys seem to be missing the point. So here it goes, in bold letters: it does not matter whether you have a good design or not, or whether or not you have an agile process (or any process). Or skilled developers. The fact of life is that you WILL have bugs in your system - and lots of them. Now, how do you deal with this fact of life, is a good question that I have not yet seen a satisfactory answer to. Here, please, share your experiences.

Re: bullshit - where is the culture?

December 14, 2008 by Wojciech Seliga (not verified), 30 weeks 2 days ago
Comment id: 2112

@Przemek:

I don't now Kurt, but I see a lot of wisdom in his words. And he does not insult anybody, which unfortunately you do.

To the point: awesome design with lots of bugs (like 0 instead of 1 in your loop) is anyway a failure. If Spring framework had such bugs in many places, nobody would use it.
However they test it and most of its users will never encounter such problems. Unit tests, functional tests, dogfooding and your programmers wits are to catch such silly bugs before your software is released.
However when you are concentrated on bug-fixing (repetitively) instead of addressing the root cause of it (which is typically a bad or obsolete design) you always lose.

So yes - bugs are everywhere. But in applications with better design there are far less of them than in apps with a bad design.

re: Cars != software

December 14, 2008 by Ilja Preuss (not verified), 30 weeks 2 days ago
Comment id: 2113

That building cars and building software are different would be a good argument for the possibility that the technique might not work for building software - if there weren't software development teams out there that tried it and proved that, in fact, it can.

re: missing the point

December 14, 2008 by Ilja Preuss (not verified), 30 weeks 2 days ago
Comment id: 2114

You are certainly right that you will have lots of bugs - at least as long as you accept that that's just the way of life.

Here is another perspective: there is no law of nature that says that there have to be bugs in software. Bugs don't creep into software - they are *put* into it. Bugs are *produced* by software developers, working with tools, processes and mindsets that allow the bugs to be produced and remain undetected and/or unfixed.

AA - arrogant agile

December 14, 2008 by Anonymous (not verified), 30 weeks 2 days ago
Comment id: 2115

I hate agile developers: i own one piece of - well you know. Fully of bugs and developers tell us "we have the method which produces best software".

re: Cars != software

December 14, 2008 by Janusz Gorycki, 30 weeks 2 days ago
Comment id: 2116

Ok, I dare you: show me one piece of software that has been produced like cars are produced in a Toyota car factory. This is nothing more than a myth. Go on, prove me wrong, right here, right now. A case study, please, with bug stats. If you are unable to produce it, please don't propagate this myth

re: missing the point

December 14, 2008 by Janusz Gorycki, 30 weeks 2 days ago
Comment id: 2117

Of course bugs are PUT in software, so what? Do you know why they are put there (no it's not because developers are dumb - most of the time). The reason is simple: any (even the most trivial) software systems are more complicated these days than can be managed by reasonable means. Do you know how many bugs exist in a simple, deployed web servlet for example? You know, the one that prints "hello world"? I bet you don't. I don't know either - because a bug can be hidden in a container, a web server that fronts it, a router, a switch, a browser, java VM, who knows where else? Even the CPU can be (and sometimes is) at fault. Every single element of any software system is a cespol of bugs. The existence of these bugs depends on so many factors that one human, no, one sizeable team of humans, would not be able to get a grasp on it.

Spring

December 14, 2008 by Janusz Gorycki, 30 weeks 2 days ago
Comment id: 2118

Wojtek,

Spring has few bugs? Oh puhleze - http://jira.springframework.org/browse/SPR

As to the statement that "applications with better design there are far less of them than in apps with a bad design" - you are of course right. It is pretty obvious. Good craftsmen produce better stuff than bad craftsmen. No argument here.

re: bullshit

December 14, 2008 by pbielicki, 30 weeks 2 days ago
Comment id: 2119

@Wojtek
Saying that someone is writing stupid things != saying that this person is stupid - and that would be an insult. I don't like when someone writes that if you have a bug in a system it means that your design is crap. That would mean that 100% of software produced by all engineers from the very beginning of the computer era is crap, which I believe is not true.

And yes Spring has lots of bugs but we will never finish and conclude this discussion because it doesn't make sense.
There are different kinds of bugs e.g. you said that Spring is a great piece of software, although it has a lot of bugs in it. It is great software because probably the bugs they have affect at max 20% of users while 80% of them use their soft without any problems. This is a different situation from one that you have a software that cannot even start - because it has bugs. This software can have much less bugs than Spring has but it is unusable. So what? Spring is better or worse?

This discussion doesn't make sense for me. One thing is still clear - no matter what design you have you will have bugs that you should track and address accordingly to their importance, criticality, whaterver-ality, etc.

Afterthoughts

December 14, 2008 by pbielicki, 30 weeks 2 days ago
Comment id: 2120

@Wojtek
Afterthoughts :) I agree on most of the things you wrote, however don't be to blinded with this vision because it's a vision of the Utopia. I wouldn't write it if I weren't working with you but I did. Note that although you are one of the best developers in the area where you live you commit stupid bugs. And you don't do it because your ideas and your designs are bad. You are human and you are made to make mistakes. And not every developer is the best one - don't look at every developer as you look at yourself.

I forgot about the funny thing. Yeah, dogfooding is really great especially when you're writing a software for an air plane, a space ship or a nuclear plant :)

@pbielicki Calm down, I never

December 15, 2008 by Kurt Häusler (not verified), 30 weeks 1 day ago
Comment id: 2122

@pbielicki
Calm down, I never said ALL bugs were due to bad design. Phrases like "often" or "in this case" don't mean "always" and "in every case".

Of course there are many types of errors.

Simple errors like the 0 instead of 1, or forgetting something, usually lead to a situation where it either works or it doesn't, and I would like to think that the developer will notice this when trying out what he just wrote, or at least during software testing.

I was trying to respond to what I though the original post was referring to, those tricky errors that keep popping up after release despite being repeatedly "fixed". These types of errors use a lot more time and effort in maintenance and debugging than the former, to the extent that the former are almost trivial. At least the simple errors can be fixed once, and then they are gone.

I still maintain that the current focus of software quality on testing and bug fixing does little beyond what the developer himself should be doing before checking in his code anyway, and the really tricky "bugs" are often just symptoms of the real problem: bad software quality. Often, but not always, this poor quality is a result of bad software design.

Bugs are not equal

December 15, 2008 by sginter, 30 weeks 1 day ago
Comment id: 2123

The word "bug" is too generic in this case.
- If you misspell a comment in the code it is a bug (very very minor, but some people care - in API JavaDoc for example)
- There may be a glitch in the UI - misaligned label etc - also minor, but still - some would care
- There may be a sporadic exception or misbehavior in corner cases, clearly invalid input, strange configuration etc - a yellow light for me, unless you get data corruption or security breach.

But then, you may have a misbehavior in usual use case, valid data, usual configuration - something that affects many users and actually is a broken functionality. This should be a show stopper - you should never allow this in released version nor postpone to fix it later.
You break the core principles of Scrum and other agile processes - producing potentially shippable product (as you should not deliver code that does not work) and more(?) importantly - you loose track of team velocity, as you have to revisit 'done' pieces over and over again.

From process point of view, I would strongly suggest finding root causes of any bug (or is "defect" a better word) and fix that first.
I am not talking about technical root cause in your code - this should be obvious.
I mean the meta root cause - maybe one of the following?
- broken development process: do you test enough? do you design enough? do you have enough time to implement your features properly?
- bad tools: is your test framework robust enough? does your CI server provide enough feedback? are your checkstyle/findbugs/IDE inspections helpful enough?
- missing skills/knowledge: do you understand the domain? do you know how to write good code? do you know 3rd party libraries you use well enough?
- bad engineering practices: do you test before you commit? automatically? including regression testing? and UI? do you refactor the code often enough? do you fix problems or just symptoms? is the architecture right?

Fail to tackle root cause first and your technical debt will just grow - no mater how much time you spend bug fixing. Congratulations, you just created yet another legacy software (meaning "maintenance nightmare", not "software that works")

re: missing the point

December 15, 2008 by Ilja Preussre: (not verified), 30 weeks 1 day ago
Comment id: 2124

"any software systems are more complicated these days than can be managed by reasonable means"

I agree that todays software systems are too complicated to be managed reasonably *using the methods that are typically applied*. It seems to me that the pure existance of teams who *do* manage to get such high quality that they get just a handful of bugs reported each year is prove enough that there are ways to reasonably manage complex projects. It seems to be more productive to me to ask "what are they doing differently" than to pretend that we are simply screwed. Your mileage may vary, of course.

re: Cars != software

December 15, 2008 by Ilja Preussre: (not verified), 30 weeks 1 day ago
Comment id: 2125

Our team actually has applied the "stop the line" practice - not to bugs (yet), but to build system failures, with much success. I can't provide you any hard metrics, though.

You are free to believe me or not to do so. If you want to know more, I suggest you do your own research. A google search on "stop the line" and software, or on "lean software development" might be a good start.

Ah, got you here :)

December 15, 2008 by Janusz Gorycki, 30 weeks 1 day ago
Comment id: 2126

@Ilja: do I get you right? Do you simply "stop the line" when your build server reports a broken build (possibly with unit and systerm tests)? Or are you referring to something more complicated than that? Because if what you mean is just having a CI setup, than you are only applying a minimum sanity check measures, You are far far away from managing "interesting" bugs in a systematic fashion. Our team too uses a CI server and we also "stop the line" when a build goes red (whoever break the build, gets to fix it ASAP). Let me assure you, this is not enough.

re: Ah, got you here

December 16, 2008 by Ilja Preussre: (not verified), 30 weeks 13 hours ago
Comment id: 2129

First, applying Stop The Line to CI does mean more than just "whoever break the build, gets to fix it ASAP" - it means that whenever the build breaks *the whole team* immediately gathers to discuss how a) to best fix the build ASAP and b) what actions to take to fix the *root cause*. For example, when broken tests where checked in, we didn't just fix the tests, we also - again just as an example - wrote an Eclipse plugin that makes it easier to execute the necessary tests. http://sourceforge.net/projects/e-rat is just one by-product of us practicing Stop The Line. Doing this has made a big difference for how often the build tends to fail.

Second, I agree that applying Stop The Line to the CI build isn't enough. It was just a start. In fact, our team lead, after seeing the results of using it for just failing builds, wants us to implement it for reported bugs in general.

Implementing it is a challenge - mostly a cultural one, actually. We will see what happens when we succeed. I'm quite optimistic.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <b> <i> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <br> <blockquote>
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>. Beside the tag style "<foo>" it is also possible to use "[foo]".

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.

Best of AgileSoftwareDevelopment.com

Recent comments