XNSIO
  About   Slides   Home  

 
Managed Chaos
Naresh Jain's Random Thoughts on Software Development and Adventure Sports
     
`
 
RSS Feed
Recent Thoughts
Tags
Recent Comments

Measure Twice, Cut Once

Sunday, March 6th, 2011

Recently TV tweeted saying:

Is “measure twice, cut once” an #agile value? Why shouldn’t it be – it is more fundamental than agile.

To which I responded saying:

“measure twice, cut once” makes sense when cost of a mistake & rework is huge. In software that’s not the case if done in small, safe steps. A feedback centric method like #agile can help reduce the cost of rework. Helping you #FailFast and create opportunities for #SafeFailExperiements. (Extremely important for innovation.)

To step back a little, the proverb “measure twice and cut once” in carpentry literally mean:

“One should double-check one’s measurements for accuracy before cutting a piece of wood; otherwise it may be necessary to cut again, wasting time and material.”

Speaking more figuratively it means “Plan and prepare in a careful, thorough manner before taking action.”

Unfortunately many software teams literally take this advice as

“Let’s spend a few solid months carefully planning, estimating and designing software upfront, so we can avoid rework and last minute surprise.”

However after doing all that, they realize it was not worth it. Best case they delivered something useful to end users with about 40% rework. Worst case they never delivered or delivered something buggy that does not meet user’s needs. But what about the opportunity cost?

Why does this happen?

Humphrey’s law says: “Users will not know exactly what they want until they see it (may be not even then).

So how can we plan (measure twice) when its not clear what exactly our users want (even if we can pretend that we understand our user’s needs)?

How can we plan for uncertainty?

IMHO you can’t plan for uncertainty. You respond to uncertainty by inspecting and adapting. You learn by deliberately conducting many safe-fail experiments.

What is Safe-Fail Experimentation?

Safe-fail experimentation is a learning and problem solving technique which emphasizes on conducting many simultaneous, small, controlled experiments with small variations. Since these are small controlled experiments, failure is an expected & acceptable outcome.

In the software world, spiking, low-fi-prototypes, set-based design, continuous deploymentA/B Testing, etc. are all forms of safe-fail experiments.

Generally we like to start with something really small (but end-to-end) and rapidly build on it using user feedback and personal experience. Embracing Simplicity (“maximizing the amount of work not done”) is critical as well. You frequently cut small pieces, integrate the whole and see if its aligned with user’s needs. If not, the cost of rework is very small. Embrace small #SafeFail experiments to really innovate.

Or as Kerry says:

“Perhaps the fundamental point is that in software development the best way of measuring is to cut.”

Also strongly recommend you read the Basic principles of safe-fail experimentation.

I say Agile, You say Traditional, Document-Driven

Sunday, May 2nd, 2010

What do you do when your team/company is all excited to be “agile”, while your customers want to operate in the traditional, heavy-weight, documentation-driven approach? Every now and then I run into Customers or companies dealing with Customers who insists on writing pages of requirement document, with specifications as vague as the night sky, insist on accurate estimates (oxymoron) on turnaround time at the moment of document handover and to not be involved again until they receive the software they asked for?*

IMHO this is one of the biggest issues teams face when they want to use more Agile ways to deliver software. I’ve been in similar situation and sometimes have been able to influence the customers to collaborate more. Sometimes I’ve not been able to. Following tricks have worked for me in the past:

1) First and foremost, it’s worth understanding why they are opting for this approach. In most cases it turns out that they don’t trust the software team and hence they want to push all the risk to the software development side. May be they have burnt their hands in the past. May be their hands are tied. Or may be they are just ignorant of the fact that this is an extremely sub-optimal way to build software. Seeing the world from their point of view, helps me understand where they are coming from. If one is able to see the underlying driving factor and break that bubble, things can get lot more constructive. For Ex: if Risk is the underlying factor, showing them how risky their approach is, can turn things around.

2) Sometimes during the scope discussion of the project, I’m able to highlight things that they’ve not thought through. Sometimes I’m able to hit the nail where it hurts the most. Immediately, the customer moves from a stand where they were saying “We know it all, just build this” to “This piece, we are not sure and it might need a little more work, but rest of the stuff you should be able to plan & estimate”. Slowly through these discussions (couple of hours) you highlight enough such instance, to point out the fact that, there are lots of uncertainties. Also you highlight the fact that we can make assumptions and move on, but it could lead to rather adventurous ending. At this point, I pull some of the biggest project failure case studies and show them how adventurous the ending might be.

3) Sometimes, I start off saying,

I’m sorry, I’m not good enough for this job. You need an expert, who have implemented the same project many times before and is extremely desperate for work to agree to your terms of project execution or you need someone who is an expert at acting to make you feel like they are in control.

I also add saying,

It does not appear to me that your are building a software project for the first time. So if you look back at your past experience, how has this approach of building software really worked for you? Be true to yourself. Were you happy with the results? Did you feel it could have been lot faster and costed a lot less? Also did you feel the team could have come up with lot of innovative, valuable ideas in the project?

Sometimes these questions shake them up a little. At this point, they want to hear more. Its very likely that you’ve touched upon some of their fears and pain points.

4) I also bring to their attention that, I’ve worked for a lot of companies who will go with the traditional model, but put a serious (expensive) change request process. They know that on an average sized project 20-40% requirements will change as the project continues. (There are graphs that show this very clearly.) Software companies typically use this approach as a way to teach their customers a lesson. And on subsequent projects or mid-way through the project, the customer agrees to collaborate more instead of tossing it over the wall. If the customer still does not agree, heck what, you make good money through the strict change request process.

5) At this point, hopefully they are slightly more open to listening to you. So I propose that we start-off with a week or 2 week inception phase to flush out some of the uncertainties and to bring everyone on the same page, so we all can agree upon the common goals. Depending on how important this project is, we price the project inception piece of work accordingly. Sometimes even free. During the inception phase, we do some brainstorming about what we need to build, how it’s going to affect/help endusers and businesses, we build some models, we build some working prototypes, etc. This helps the customers experience the value of collaboration. (It’s like the trailer of the movie.) In my experience so far, most customers see the value, we are able to build some trust and respect for each other and we are really set to build a project using agile methods.

6) After all this, if they still don’t see the point, I tell myself,

Life is too short to waste time on such projects. Time to find a new project/customer. In fact life is too short to build products for others. Its high-time I build my own products.

Interestingly, I’ve had some customers who understand all of this stuff and tell me that the main reason they don’t want to collaborate is, they fear they might get attached to the project. And will not be able to take objective calls. This is a valid point. When I cook something, it always tastes good. Even if it does not, I keep trying to make it taste better. Hard to draw the line. In case of software projects, we can work out strategies so customers are able to collaborate but still take objective calls when they need to.

* This question was asked by Stephen Walters on the Agile Alliance LinkedIn Group.

Use Cases v/s User Stories

Tuesday, April 20th, 2010

At the Agile Coach Camp Goa 2010, we had a small side discussion about the difference between Use Case and User Stories. More importantly, if an Use Case contains many User stories or whether an User Story contains many Use Cases.

According to Mike Cohn, User Stories are smaller in scope compared to Use Cases.

Even Martin Fowler has the same understanding.

IMHO it does not matter. But it’s important to note that when some people refer to User Stories, they really mean the final stage of the User Story. Hence they always say, an Use Case contains many User Stories. In real world, I see User Stories have a life-cycle. They start out big & vague and gradually are thin sliced to executable User Stories. Mike Cohn referes to them as Theme > Epic > Story > Task.

I’m particularly influenced by Jeff Patton’s Work on this topic. Jeff highlights that User Stories really need to be at an User Goal level rather than an implementation level (at least when you start out). Else it would lead to big-upfront-design. Also most users won’t be able to relate to really granular stories. Highly recommend reading his blog on The Mystery of Shrinking Stories.

To understand the overall approach check out his User Story Mapping Slides.

Pairing FAQs

Friday, January 12th, 2007

Yeah, Yet Another Blog on Pairing and Pair Programming.

Question. What are the disadvantages of Pairing?

My experience with pairing has been good so far. I‘m not too sure if I can really point out disadvantages. But here are some things to be aware of.

  1. One thing that does bother me a little is, it can get into the way of your creative thought process sometimes. But most of the times, I‘m happy with the end results.
  2. Some people also complain about the trashing of ideas that goes on when people pair. It might feel like the pair is wasting a lot of time just abstracting arguing about the approach or their understanding of the problem at hand. Again, this is not really a disadvantage of pairing. Any time you have more than one person, there will be differences in their perception and approach. According to me, it better to clarify them sooner than later. Usually if the pair cannot converge on one approach, one of them drives [implements] her/his approach. If it works, they move on, else the other person drives her/his approach. Lot of times they come up with a 3rd solution which is better than both individual approach.
  3. There might be other interpersonal issues that could arise while pairing. But its better to resolve them rather than ignoring them. And it‘s not unique to pairing. Any team activity would have the same issues. A good example that comes to my mind is ego clashes between people. It‘s better to resolve it rather than letting it grow.

Couple of things one should remember:

  1. Pair programming is not about typing code. If you have watched a really good pair programming session, there is very little typing and more of communication/discussion. Designing good systems is not about typing code, it needs a lot of brainstorming. No I‘m not suggesting big upfront brainstorming sessions. You need Just-In-Time brainstorming. Closer to the time of implementation. Also people often under-value the feedback they get from code. Everyday I learn from my code and from other people on my team.
  2. Pairing is not just limited to programming. We do a lot of cross-functional pairing. Developer pairing with the Business Analyst to write automated acceptance tests. Developers pairing with QA to recreate bugs. QA pairing with BA to do exploratory testing and so forth.

Question. Some people do not want to pair program, they are lone contributors and pairing slows them down, they just stop thinking, they feel less productivity. How do you deal with this? Can we possibly reduce pair programming hours? May be ask people to work separately for 2 hours and sit for 30 minutes to pair program.

Like any skill/habit, people take time to learn it.

When I was in University, the natural thing to do for me was to work with others [Profs and students]. I learned programming by working with other students [pairs]. Once I joined a software company, I was given a sound-proof cubical. I drifted on my own and after a while I got used to working on your own. Changing this habit back to working with another person took some time [a week or two]. But the people I was pairing with were really good and there was a motivation to pair with them. After that I don‘t see “the pair slowing me down“ thing happening much.

Every single time I‘ve worked with a team, “lower productivity” comes up as the first argument against pairing. Laurie Williams of the University of Utah in Salt Lake City has shown that paired programmers are only 15% slower than two independent individual programmers, but produce 15% fewer bugs. Since testing and debugging are often many times more costly than initial programming, this is an impressive result. There have been a lot of other studies, which prove that lower productivity due to pairing is a myth.

While we are on the topic of productivity, let me back up a bit. How do you define productivity? Amount of work done in an hour or day or sprint/iteration? This looks short-sighted. We are talking about software project which has a life span bigger than hours or days or sprints/iterations. Shouldn’t one consider, UAT bugs, production bugs, support calls, ramp up time for new team members, maintaining all kinds of crazy documents, etc?

Faster learning, better communication, collective code ownership, shared understanding, evolutionary design, better estimates, continuous code review, etc all go hand in hand with Pair programming.

So I would strongly discourage people working separately for 2 hrs and pairing for 30 mins as a regular practice. I would reverse the time.

Often on teams, people want time to check their emails, answer some calls, go to meetings, etc. These things do come in the way of pairing 8 hrs a day. So what we do on most teams is to have core-pairing hours.

For Ex:

  • 08:50 : 09:00 – We have our stand up meeting
  • 09:30 : 12:30 – We have the first core pairing session.
  • 12:30 : 02:00 – People are free to do other stuff and lunch.
  • 02:00 : 03:00 – Any team meetings if required.
  • 03:00 : 05:30 – We have another pairing session.

Sometimes we have another stand up at 5:30.

So in an 8 hr day, we at least have 5.5 hrs of pairing. Remember pairing can be very intense and it could drain you out. So its usually not recommended to pair for more than 8 hrs everyday.

There is always going to be resistance to pairing. The biggest reason I have found so far in 10 years is, fear of exposing how much one knows to others. My theory is, usually junior people are much open to pairing, coz everyone expects that they don‘t know much and they don‘t really have any fear of exposure. Also they feel they can learn much faster that way. On the other hand, people who want to hide in their cubical will always resist it with irrational/unacceptable reasons.

The best thing to do is have an open team discussion on this topic. Challenge people in front of the whole team. Ask for facts.

IMHO, Pair programming is not effective in the following cases:

  1. If you don‘t have a team room and team members are not sitting at a common table. If people go back to their cubical and try to pair, it is usually not effective. Most cubicles are built for one person to sit in. Trying to fit 2 people in there, mean one person is always going to look over the shoulder of the person driving.
  2. If your are not following Promiscuous pair programming. If your pairs are not swapping frequently [at least once a day], then you are going back to old ways of programming. Instead of one person now you have 2 people. So what? You need more pair of eyes. You need collective code ownership and not pair code ownership. Please note Promiscuous means “making relatively unselective, casual and indiscriminate choices.”  Pod cast and Slides.
  3. If developers are not involved in estimation and planning. If there is no collective ownership and self-organization.
  4. If you already have spend more than 30% of your project budget on BIG UPFRONT DESIGN. And if you have architects on the team who don‘t want to pair but just want to create fancy documents and throw it over the wall.
  5. If your manager assigns tasks to the pairs

Question. Some people want to pair program, but they do not pair well, i.e. though they are looking at the same computer but they are actually planning a vacation, i know this may sound ridiculous but it happens. How do you deal with this?

Talk to them. Very very important. Understanding their issues is most important. You cannot afford any communication gap.

Encourage them to try ping-pong pair programming.

Question. Where can we find a demo of good and bad pair programing?

At the end of the Programming With the Stars @ the Agile Mumbai 2010 conference, based on public demand, J. B. Rainsberger and yours truly did a 6 min public demo of Pair Programming. We started with an Ugly Pairing session, trying to show-case some pairing anti-patterns.

Followed by a normal pairing session:

Question. What does a really good pair programming experience feel like?

When each programmer has an implementation/design in mind, but in the process of pairing we end up with a 3rd, much better solution. The collaborative attitude and mutual respect amongst the pairs is very important.

Question. What does a really *bad* pair programming experience feel like?

When wavelengths don’t match and each programmer just wants to prove their point. Or Programming with someone who just does not care about the craft. If I was coaching them, these might be a good opportunity to educate them, but when trying to rapidly build world class products we don’t have time for this. Hence these are bad experiences from a pairing point of view, but good from coaching point of view.

Question. What setup makes pairing experience enjoyable? Both sharing one machine? Both sharing a single keyboard, mouse & screen Or Two keyboards, two mice & two screens?

I’ve paired for 10+ years now and based on that experience I don’t think any of these things matter. The attitude of the pairs matter exponentially more than the set up.

Question. In your good pairing experience, what best describes how you worked together?

  1. We were both focused on the code, and probably shared the keyboard fluidly.
  2. We were both focused on the code, and passed the keyboard according to a system (like ping-pong or popcorn pairing)
  3. One pair sat back and watched while the other coded, and we traded occasionally
  4. One pair did research or worked on something else while the other coded

While pairing, coding is a very small activity. What is most valuable is discovering an approach/solution through collaboration. Hence I would say who code does not really matter to me any more, as far as the pairs agree on the approach and then constantly inspect and adapt the approach.

Question. Some tasks do not seem fit for pair programming at all, they are too routine/mundane to have a pair work on them. Do you see this happening?

I often hear research, reading a book, searching on the net, learning new technology, documentation, etc. fit into this category.

I do most of these along with my pair and I find it really helpful and fast.

For Ex: While searching for something on the net, one might go to Google and start entering their search criteria. I often spend a lot of time refining my search criteria. While, when I‘m pairing, we discuss the search criteria, refine it and in the process always come up with a better search criteria, than the one I would have come up with myself.

Documentation is another very good example. Documentation is very similar to programming to me. There is something in your head, that you want to communicate. By working with a pair, one can ensure that what is been documented/expressed, is understandable by at least one other person. You might be making a lot of assumptions that are not clear to other people. Hopefully your pair will challenge some of those assumptions, leading to more understandable documents and hence better quality of the document.

I tend to pair on all these tasks, coz there is some knowledge involved in these tasks. I would like my team members to be aware of how to accomplish similar tasks later.

One of the things I have noticed in the past is, if its a single person trying to do these kind of tasks, they might be motivated to just manually do it and get done with it. Or sometimes, they might spend days together coming up with a framework to accomplish the task. But if a pair is working on it,

A [one of them] might say, “you know what, we might want to create this thing again and again, lets just quickly automate this“.
B might say, “but automating this might take 4 times more time than what we have estimated for this“
A: “Really, I was just thinking of writing an ant target to do this“
B: “Ohh…Yeah that‘s a good idea. But I‘m not very well versed with Ant“
A: “I have done some work with Ant, so I think we can get this done in 30 mins“
B: “Excellent! Lets get rolling”

You see…whenever there is learning involved, quality of end product is much better. Never under-estimate the outcome of 2 brains at work.

Question. What about remote pairing?

Since I’ve started working for Industrial Logic, I’ve spent a lot of time time pair programming with folks in the US. Yes, we do Remote Pair Programming.

Quite a few people have asked me:

  • What special editor or tool we use for remote pairing?
  • How effective is the pairing?
  • How much time is spent in setup each time?
  • How long does it take for one to get used to remote pairing?

Here is my answer:

The most important part of pairing is free flow of ideas between the 2 individuals. Its about the brains of the 2 individuals being at the same wavelength so communication can truly take place. Tools can certainly disrupt or get in the way of this flow. But IMHO the individuals contribute 80% towards the success of the pairing experience, tools contribute 20%. Skype with Video Sharing lets us achieve 80%. Better tools might improve that. We’ve experimented with some Eclipse based plugins, all of them have their trade-offs. There is no clear winner. Also on our team since we’re all used to Skype for conference calls, the threshold to get started is very low. So my recommendation is to get started with simple tools, something that you are already familiar with. When starting anything new, focus on the crux and not on the peripheral stuff.

Question. Won’t Pair Program kill our Productivity?

Often I find developers and managers who claim they understand the advantages of Pair Programming and are bought into the concept, but they are really concerned about loss of productivity.

This morning when I watched the following video, I thought, we could use this as an excellent example of what pairing can help you achieve.

My premise:

We are in the business of building software and this process requires craft and skill, rather than a series of manual steps. Programming requires lot of thinking, creating abstractions, figuring out the logic and trying out things. Its an evolutionary, iterative and collaborative process. Its a lot more than just typing code using the keyboard (or even worse, using the mouse).

If you resonate with the philosophy stated above, then you should be able to understand how pair programming can make it easier or more feasible to create master pieces that could be extremely difficult or rare for one individual to single-handedly create.

    Licensed under
Creative Commons License