Monday, November 21, 2011

Kanban Introduction

Kanban Blog

Saturday, September 17, 2011

WIP limits - The magic sauce in Kanban


A software development process can be viewed as a queuing system. Little’s law states:

Lead Time = Work In Progress / Throughput

Lead time is the time that a work item (represented by a card on a Kanban board)  spends in a system in various work states. We want to reduce that, so we can get more work done i.e. increase throughput. As you can tell from the equation, reducing WIP (work in progress) is one way of achieving that. 

Less is more

We've all heard that and have certainly experienced that. That's an earthy way of stating Little's law. We can get more done, when we are focused and working on fewer things.

Why?

We are not wired to work on multiple tasks at the same time. When we say we are multitasking, we are really switching our attention from one task to the other i.e switching contexts. Context switching is a waste. Studies have shown that with every additional task taken up there’s a 20% loss. If we are working on three different tasks, we’ve lost almost half the time in just context switching.

Grandma was right - less is more. But don't tell grandma that. Not unless you want her to limit you to just a couple of  freshly baked cookies instead of the usual half dozen. 

Ok, we should limit WIP.  But how do we determine the WIP limit?

We experiment.

If we set the limit too high, we will continue working on multiple tasks. If we set the limit too low, we may cause bottlenecks and affect the flow of work in the system.We want the WIP limit to be optimal so we can have a smooth flow.

But it’s not a science. The board will tell you. 

There are advantages to starting with a lower WIP limit

Yes, they’ll cause starvation and pain. But lower limits will expose potential problems in the system. The industry uses the analogy of the WIP limit with lowering the waterline. Lowering the waterline exposes the rocks (i.e. bottlenecks and constraints).  When the problems are exposed, the team can work to remove the bottlenecks and constraints until the work flows smoothly again. 

And so on and so forth.

It creates slack

When everybody is working  all the time, there's not much time to introspect, retrospect, experiment, innovate or even  have lunch. As a rule of thumb, lead times go up when utilization crosses around eighty percent.  High utilization is not good. We've probably experienced this when the highways begin to fill up with cars or when the CPU on the computer gets toward its capacity.

How do we create slack?

We could hire additional members on the team. Imagine going to the folks that handle the purse strings and telling them that we want ten developers in the team but we only want to keep eight developers working because we've heard that utilization  at above eighty percent is not good. Good luck with that :)

Or - we could apply WIP limits

If we have a team of ten and we've put an overall WIP limit of 8, and assuming only one person works on an item at a time, we've taken away work from a couple of developers. In other words, we've intentionally created slack (or  excess capacity). And slack is good because it will allow these two "idle" developers to do a few things such as pair up with other developers or help resolve issues at bottlenecks.

And funnily enough, this will help get more work done.

It's an enabler for a "Pull"system

A pull system is one where the downstream process pulls in work only when it's ready to process it. This will result in producing only what's needed, transferring work to a work station when needed and reduce inventories i.e. it will help result in a lean outcome.

When we have WIP limits, we cannot take on work unless  we have a "slot" available on the work station. We are consciously defining our capacity to take on work. Imagine if we did not have limits. Work would be "pushed" to us by the upstream process - whether we were ready or not. And  most likely, it would just wait  to be acted on. That's a waste.

WIP limits make Kanban a "Pull" system.

It's an enabler for Kaizen

It's not that we don't want to improve, but it's usually that we don't know where to start. Or what our bottlenecks/problems are. Lower work limits are a great enabler for continuous improvement (kaizen). When you run into the bottleneck, resist the temptation to immediately raise the WIP limit. Get a conversation started in the team and look to resolve the bottleneck. 

Pound the rocks to submission. And if you still have a bottleneck, raise the limit to enable flow.

Trust the board. The board does not lie.


Wednesday, April 13, 2011

BDD is not about tools


Many teams practicing BDD assume that the tool is the process. A lot of chatter is about: 
  • What BDD tool (or framework) should I use?
  • How should I use that tool?
  • Is tool X better than tool Y?
  • Etc., etc, etc. 
So much noise, that I’m afraid the intrinsic value of BDD is lost. Just because you are using a BDD tool, doesn’t mean you are practicing BDD. The tools are important, but not absolutely necessary. You could get a lot out of BDD without a tool. Here’s what I mean.

BDD helps build “Software that matters” 
In order to do that, you should capture requirements as behaviors resulting in a list of “behavior specifications”. In fact, that is what gathering software requirements is all about. You should define what the software should do (i.e. behavior) and frame it in the context of the business value.

But that’s hard.

Waterfall teams tend to write verbose documents, that developers find hard to understand. Agile teams err on the opposite side, writing terse user stories that often do not have enough information. BDD helps bridge the gap with the notion of User Stories that have two components: (a) Narrative and (b) Scenario.  The scenarios are the acceptance criteria and provide examples of how the software should behave. It helps to illustrate the narrative, providing a concise, yet vivid description of the expected business outcome.

You don’t need any new tools to do this.

It provides a language to document the behavior
The narrative is written in the format:

As A [role],
I want a [feature],
so that I [benefit])

The scenario is written in the format:

Given [context]
When [even]
Then [outcome]

This is a very structured way to express behavior.  “Given” describes the context or state of the system, “When” describes the user action or state transition and “Then” describes the outcome or expected behavior.  This expression almost feels like code. Yet it is in a natural language and more importantly, is in the language of the stakeholder. Because of the reduced ambiguity, you are likely to get what you are asking for. Especially, because you are also kind enough to tell the programmer/QA Analyst why a feature is required – a very important aspect of software requirements that is often ignored. Just adopt this format for your software requirements.

You don’t need any new tools to do this.

But it’s more important to discuss the behavior
Don’t just define behaviors, discuss them. Leverage the “Power of Three” i.e. the Business Analyst (a proxy for Customer or Product Owner), the QA Analyst and the Programmer in defining behavior. You can start with having the Business Analyst write the narrative and scenarios for the user story. But be sure to have the QA Analyst and the Programmer review the user story. Good QA people can elaborate the user story. Programmers can keep the specification realistic. Discuss it together, even if only for a brief time. These three stakeholders bring very different perspectives and expertise to the table. You’ll find that the scenarios get fortified with better acceptance-tests, including behaviors that were not originally considered. At the end of the conversation you will also have a definition of “done” for the user story.

You don’t need any new tools to do this.

It’s about baking quality in
Many defects occur because the requirements are ambiguous and subject to the programmer’s interpretation.  BDD fixes this through the scenarios with their rigid grammar. The scenarios provide the cues to the programmer to build the right features.  Defects also occur because the behaviors are not completely defined. This can be fixed by using the “Power of  Three” to inspect the user stories, discuss them and finalize them. This may take some time, but the investment will pay off. As the Toyota Production System says, “Inspection to find defects is waste. Inspection to prevent defects is essential”.

You don’t need any new tools to do this.

Engage the stakeholders
Leverage the “Power of Three” at every opportunity. Include the Business and QA analysts in the design and architecture conversations. Encourage the Programmer and the Business Analyst to review the test cases. When stakeholders, especially those that are more “outside” than “inside”, get involved in design conversations, they are more likely to drive a better understanding of the need and therefore influence the behavior.

You don’t need any new tools to do this.
However, you will need the BDD tools if…
You want to create “Executable Documentation” i.e. you want to record the behavior specifications in the BDD grammar in a BDD tool. Typically, these tools generate skeleton code, against which you write production code following TDD practices. Similar to the XUnit tools, initially tests will fail, and when the behavior is implemented correctly, the tests will pass.  This will provide traceability from the code to the business value.  More importantly, if you are disciplined, you will write just enough code to meet the behavior, thereby reducing waste.

In conclusion
A lot of the intrinsic value of BDD can be realized by:

-  Applying its User Story format
-  Documenting requirements using the recommended grammar
-  Leveraging the “Power of Three” to bake quality in the process
-  Engaging stakeholders to ratify and discover new behavior

And all of this can be done without BDD specific tools.

If you believe you are already following these best practices, then it's time to reach for the BDD tools. But not until then.

Sunday, February 20, 2011

BDD - Words matter

BDD is a lot about using the right words. Even as BDD leverages benefits of ATDD and TDD, this is an important differentiator. One could even argue that BDD was required because TDD did not quite get the words right, even as it otherwise provided an awesome methodology. Consider - how often have we had a need to say that TDD is not really about tests even if the T in TDD actually stands for tests?

Words, if used incorrectly, can get in the way. Conversely, using the right words, causes the right thoughts. The right thoughts, lead to correct actions. Correct actions, lead to desired outcomes.

The right words have a very subtle and powerful effect. If all you did was TDD but substituted the word “behavior” for “test”, you should already begin experiencing a paradigm shift towards BDD. Very different questions start popping into your head. Instead of “What should I test?”, you might hear“What’s the intended behavior?”. This will cause you to think differentlyand therefore, you will write very different code.

Words matter to build "Software that matters". And BDD facilitates this.

Saturday, January 22, 2011

Stress in Agile teams

People working in agile teams sometimes complain that stress levels are higher in agile projects. Now, we all know that it is not supposed to be so. After all, don't agile projects distribute work more evenly for the duration of the project? Aren't agile teams supposed to be self organized and responsible for signing up for an appropriate load of work in a sprint (can't even blame management now)?

Agile experts are quick to point out that the increased stress, if that's even true, is most likely the fault of the agile coach / scrum master. Don't blame the agile methodology, they say. But then, there have always been good managers and bad managers and there certainly are good agile coaches and bad agile coaches. In many teams, the managers have now become scrum masters or agile coaches. When the same team, under the same manager that was practicing waterfall or iterative development is now practicing agile and is complaining about additional stress, could there be some truth to the statement?

Let's examine possible reasons for the stress and potential ways to mitigate them.

The Daily stand-up: This is the heart of many agile processes. This is also a potential stress point. Think about it. Day after day, you are asked to give an account of yourself in front of others. What did you do since your last stand-up? What do you plan to do today? Like it or not, you are subjecting yourself to intense scrutiny. There's no place to run and no place to hide. You cannot help wondering what your team mates think of you. You cannot help comparing yourself to Joe who always seems to get more done in the same time.

How to mitigate it: 
Emphasize to the team that skills and experience vary between individuals. Some are more skilled and experienced than others and may even be earning substantially more. Therefore, it is natural that they will produce more. Do not compare yourself with the performance of others. Just do the best you can.

Commitment:
 In agile, as in life, it's the many small promises that we make that adds to the pressure. In an agile process, specifically in the daily stand-up, we are making promises everyday. We call them commitments. It's human nature to want to meet those commitments. We are essentially honest people and we want to live up to our promises. Until we fulfill that promise, it's hanging over our heads like the proverbial sword of Damocles. And if we fail to keep the promise, we feel guilty. Even, if it's not entirely our fault.

How to mitigate it: 
Don't not use the word "commit". Instead, say "try". Don't say "I commit to do X". Instead say, "I'll try to do X". It's a subtle but important difference. Notice how there's no promise to deliver? Does that mean you are going to work any less harder? No. Remember, we are honest people. Our teams trust us.And we will do what we can to complete X. 

But we did not commit.So there is no expectation tomorrow that it will be done.We'll sleep better and perhaps even make it home in time for dinner.

Estimates:
When teams or individuals estimate tasks, they are implicitly committing to the hours. When we commit, we take on stress.

How to mitigate it:
Do not ask for estimates. Instead, attempt to "right size" the tasks using techniques like T-Shirt sizing. Measure the time taken to complete the task from the time it is started. The task will start when it does and complete when it does. As the team gathers these metrics they will also become more adept at "right sizing" the tasks. The eventual outcome is a steady velocity for the team.  And since the team is not providing estimate that they have to commit to, the stress is also less.And when the team is less stressed, they produce more.

Conclusion
Agile processes introduce stress in many subtle ways. Some of these are an outcome of the high visibility and transparency of the methodology - the very techniques that make agile so successful. This stress is not introduced intentionally - rather it is an unintended side effect. Being aware that the stress is real and tangible can help us mitigate it.

Unless we acknowledge it, we cannot manage it.