CodeBetter.Com
CodeBetter.Com
RSS 2.0 via Feedburner
           Do you Twitter? Follow us @CodeBetter

Ian Cooper [MVP]


When does design happen in agile?

Someone at work, new to agile approaches, asked me about when agile projects do design. I thought I would share my answer in case others were still wondering, and to try and explain where experience may have lead to us activities that are not textbook.

The short answer is ‘all the time’ and ‘just-in-time’. The long version is ‘all the time’ in that we are always thinking about design during story gathering, planning etc. which is why you want as many people on the team involved as possible. When we say ‘just in time’ we mean that we leave it to the ‘last responsible moment’. Of course the hard part is figuring out when the ‘last responsible’ moment is. I like Alistair Cockburn's model that the objective of any activity ins software development is to provide just enough for the next activity to take place. So we would tend to do just enough design to let us being development.

Being more concrete: 

  • Agile projects do design through TDD, so called emergent design or incremental re-architecture.
  • XP supplements TDD with pair programming, so at least two people design everything.
  • XP recognizes that some design needs to be all team, and has an optional CRC path, in each iteration, for contentious design choices or complex problems.
  • Crystal does not mandate pair-programming, and scales to larger teams, so it has more ceremony. It’s not uncommon for a crystal project to model the core domain model up front.
  • Most agile teams recognize that there is a nebulous conception or inception phase when you gather user stories, organize and understand them, do just-enough modelling,  set up build servers etc. It is the great unspoken step of many agile methodologies.
  • We care more about the domain model when modeling than about the infrastructure. Early on I would never tend to model the infrastructure.
  • Any ‘up-front’ modeling, before coding, is high-level, not low i.e. we care about classes, roles, responsibilities, and collaborators, but not attributes, methods etc. I tend to favour Rebecca Whirfs-Brock’s Responsibility Driven Design for this, and would consider this her Exploratory Design phase.
  • The conversation is more important than the artifacts the conversation produces. This is why CRC cards are great because the artefact is less important than the design discussion among the team and running the scenarios. You may produce a UML sketch of the system at the end, but it’s just an aide-memoir to the discussions, not a blueprint. It is also why design needs to be ‘all-play’. We don’t want to punt documents over the wall to developers, we want them to be involved in the activity of design from the beginning. That way the documents don’t inform, they just record the discussion. That’s what a document is after all.
  • CRC cards also work well because they have feedback - running through scenarios. We tend to divide up the cards and throw a ball between participants as the system calls their classes act. That means you get some testing around your design as you do it.
  • Remember that you are looking for ENUF, just enough design to make the next step, development, possible. If you end up throwing away too much of your initial design when you get to coding you have created waste, which we are trying to avoid, so don’t push this exploratory design step too far. Just do enough to answer the key questions
  • Be proportional. If you have ten user stories you may not need much of a conception phase. If you have two hundred you may need more.

The N-Tier with LINQ posts almost finished so should be out in the next few days. There is really only one post in the series after that, then we will move on to looking at hard-to-test areas in TDD.


Comments

Arjan`s World » LINKBLOG for May 29, 2008 said:

Pingback from  Arjan`s World    » LINKBLOG for May 29, 2008

# May 29, 2008 11:27 AM

Troy DeMonbreun said:

Love this article!  Thanks for addressing a nebulous subject that is very rarely addressed by Agile practioners.

# May 29, 2008 12:01 PM

DotNetKicks.com said:

You've been kicked (a good thing) - Trackback from DotNetKicks.com

# May 29, 2008 12:02 PM

Dew Drop - May 30, 2008 | Alvin Ashcraft's Morning Dew said:

Pingback from  Dew Drop - May 30, 2008 | Alvin Ashcraft's Morning Dew

# May 30, 2008 9:54 AM

Jordan Bortz said:

This "emergent" design stuff that has been bandied about for so long is horribly inefficient.

Now people should be in acceptance of refactoring their SQL Schema, Stored Procs, Entity Models, and Domain Layers just because they wanted to start coding right away?

Doesn't make a lot of sense to me; design a little more up front and you'll have a lot less refactorings to deal with....

Jordan

# May 30, 2008 3:42 PM

The Inquisitive Coder » Blog Archive » Weekly Links 6 said:

Pingback from  The Inquisitive Coder  » Blog Archive   » Weekly Links 6

# May 31, 2008 9:50 AM

Ian Cooper said:

@Jordan Well emergent design is a part of what is overall known as incremental re-architecture. Experience should tell us that we don't tend to get the design right first time around, often because we did not get the requirements right initially, but sometimes because the technology does not behave as expected. While we can mitigate, by using user stories for requirements gathering so that we keep asking, by spiking technologies, by running CRC card sessions to walk through a potential design, there will always be surprises and revelations.

TDD helps us get to many of those 'revelations' early by putting the stress that usually causes them to appear, satisfying test criteria up front, so that we hit issues early. This is particularly good at making sure our code meets requirements.

Being pragmatic we need embrace the fact that even that may not be enough, but fortunately our tests allow us to refactor easily, so that we can be amenable to changing our architecture.

The point that your application will change for new requirements post its first release, coupled with the fact that you cannot predict what those changes will be (many will be unanticipated domain changes) and that a system spends 90% of its life in maintenance mean that you need to accept that your architecture will change, and you should be in a place that lets you do something about it.

# June 3, 2008 4:17 AM

Jordan Bortz said:

@Ian

Possibly -- however, using the "Do the Simplest thing that could possibly work" and YAGNI principles, both hallowed ground among the agile crowd, practically guarantees one will do much more refactoring than necessary.

Sometimes requirements change, sometimes they do not. Sometimes they change subtly, sometimes they change drastically.

I believe there should be mechanisms in place to allow for changes, but I also believe that developers should do more  design and requirements gathering up front, which will prevent many needless refactorings from occurring...

Jordan

# June 3, 2008 4:54 AM

Leave a Comment

(required)  
(optional)
(required)  

Enter the numbers above:
Add
Check out Devlicio.us!

Our Sponsors

Free Tech Publications