All About Agile | Agile Development Made Easy


Avoiding Mini-Waterfalls

by George Dinwiddie, 1 November 2012 | The Agile Blogosphere

This content is syndicated from George Dinwiddie's blog by George Dinwiddie. To view the original post in full, click here.

A lot of people and organizations, when transitioning from a serial software development lifecycle toward an Agile one, fall into the pattern of mini-waterfalls. They start doing iterations, but each iteration resembles the development lifecycle they already know. The programmers do some design work, then they write the code to implement the design, then unit test the code, and then they pass it to the testers for testing. To many people, this is the only way it can work. Their mental model only admits to this series of phases.

And they run into typical problems. Sometimes the design doesn’t fit the problem well, and patches are needed because there isn’t time to go back to design. The testers get squeezed for time at the end of the iteration, and no one knows how to accommodate the rework when a problem is found. More patches are added, because there isn’t time to redesign. And the next iteration starts the cycle over again.

Sure, doing this in two to four week cycles beats doing it in six to twelve month cycles. But only a little. Most of the time, it starts to fall apart if the team doesn’t learn to work differently.

But it’s inevitable, they say.

No, it’s not inevitable. Some teams don’t work in a serial fashion. That’s a simple existence proof. A single counter-example should be sufficient. Of course, people are not logical beings, so it’s not. They cling to what the know, deny what they don’t know, and sometimes get angry with people who disagree.

A first step toward finding an alternative is to think about all the individual details of designing, coding, and various sorts of testing. If you break these activities up into little mini-activities, you’ll quickly notice that a lot of them do not depend on each other, and can be done in arbitrary order. You can remove a lot of the serial nature without dropping the serial mindset.

A second alternative is more radical. You invert the entire sequence. Rather than starting with design, you start with testing. While you’re first discussing what functionality needs to be produced, think of some examples that illustrate what it needs to do. Think deeply, and look for situations that your examples don’t cover. Create more examples for those. This questioning the requirements is, itself, a form of testing. It’s also a great communication boon. I like to use a process I call The Three Amigos. And having those examples in mind helps the programmers hit their target more accurately.

Now it’s relatively trivial to turn those examples into automated tests for that functionality, even before the code is written. Just automate the examples, expressing your expectations at the end of each. Of course, they won’t pass until the code is completed, but that’s OK. Once they’re automated, running them is trivial.

The developers don’t have to start with designing before coding, either. Again, start with a test. In this case, it’s a unit test. The examples that illustrate the requirements will surely give some ideas for a starting point. Write a unit test (or microtest as GeePaw Hill calls it; these aren’t your father’s unit tests) and then write just enough code to make it pass. Once it passes, then consider the design, refactoring the code to eliminate duplication and push bits of functionality into a shape that makes a good design. It sounds backwards and impossible until you try it. At least, it did for me. But it does, in fact, work to reverse the waterfall flow. (I don’t always proceed without a design in mind. Sometimes I can’t stop myself from thinking of a design before I start. But I don’t delay starting while I think about the design. I do that thinking as I code and refactor.)

As the code starts to take shape, I may need to add a little glue code to connect the already-written tests to the code I’ve just written. At some point, the tests pass. Is it “test-after-code” if the code is the last thing written? I wouldn’t say so. Of course you will want to do some exploratory testing as each part demonstrates it’s met the explicit criteria of the examples.

As written above, this sounds very mechanical. In actual practice, it’s a lot more fluid. People are talking with each other all the time, noticing loose ends that have been missed, and taking looks from multiple points of view throughout the process. No one is too fussed about the order of the activities. They’re fluid enough that, to a first approximation, everything is happening all the time. And it’s a far cry from mini-waterfalls each iteration.

Home



Leave a Reply

What is 6 + 4 ?
Please leave these two fields as-is:
Please do this simple sum so I know you are human:)