Thursday, April 10, 2014

Cookies and Software Development

Did you know that cookies are central to software development? They are. Cookies are an important engineering concept to understand.

Now, I know some of you are thinking, "duh, my web browser uses cookies!" Well, that's not the kind of cookies I'm talking about. I'm talking about the kind of cookies that you lick.

Cookie licking is when someone gives you a cookie, but you don't eat it. You just lick it, and now no one else wants the cookie, 'cause it's like totally gross now. Yuck.

How does this important engineering principle apply in day to day software development? Let me walk you through a totally real example using my friend Bob.

Bob works at a large multinational corporation named... Conglom-o. Maybe you've heard of it?

Last week, Conglom-o's senior VP of marketing  read on Tech Crunch that ultra rich people using canons to shoot cattle at major national monuments is the next big thing. Bigger than the mobile social cloud 2.0. Gee wiz!

So now Bob's team has been assigned to design a web service that allows eccentric billionaires to remotely control their cow launchers from their diamond encrusted iPhones.

Just today, a new task came in. After an intensive focus group with Mick Jagger and Donald Trump, it was determined that being able to choose the breed of cow is very important to rich people. They don't want to plaster a Holstein against Tomas Jefferson's granite face when an Angus is more appropriate. So, now someone needs to add a cow selection parameter to the launcher service.

Bob's manager points at him, and says "go do it." Unfortunately, Bob was already working on the code to control the attitude and acceleration of the cows within the canon. So now Bob must juggle both tasks and won't get either done real soon.

Later Bill, Bob's teammate, finishes up the widget he was working on and doesn't know what to do. Bill then talks to each of his teammates and asks if he can steal one of their tasks. When he talks to Bob, Bob still hasn't finished either of his tasks, but he's reluctant to transfer either of his halfway completed projects to Bill. The code is still a mess, and it will take him a while to explain to Bill the ins and outs of his cow selection algorithm.

Bill ends up going back to his desk and works on some lower priority tasks, and Bob is overworked trying to finish both of his tasks.

So, how do these cow launching tasks relate to licking cookies? With metaphors, yay!

As soon as the task chooser cookie is placed on Bob's assignment plate, Bob licks it. Maybe he even takes a little bite out of it. But he doesn't have time to finish the cookie before hungry hungry Bill comes over looking for some delicious task cookies to eat. Except, no one wants a gross half eaten cookie. So, Bob has to turn away Bill and sit there stuffing his face, crying because he's not even hungry anymore.


You know what would make this story better? A serving plate. If they'd just left all the damn cookies on a big serving plate, and no one took more than one cookie at a time, Bill wouldn't be starving and Bob wouldn't be eating himself into hyperglycemic shock.

The practical lesson here is managers should not assign work. Rather, just record all the work in a central place and let developers take a task as they finish up whatever work they were doing before.

Another logical addendum, is that since some work is higher priority than other work, the list of pending work should be sorted by priority. Then whenever a developer is looking for a task, he just grabs the highest priority one from the list. This prevents the case where high priority but unpleasant tasks, such as fixing bugs, get delayed while developers focus on more interesting work.

It turns out that companies have been fighting the cookie licking problem for a long time. Toyota originally developed advanced anti-cookie licking techniques to speed up their car production pipeline. Of course, they called it the Just In Time production strategy, but I like the term anti-cookie licking strategy better.

Now all the cool kids have adapted Toyota's anti-cookie licking strategies into fancy Agile or Kanban methodologies. There's a mini industry where you can hire methodology hipsters to come into your company, slap the cookies out your hand, and yell "Don't lick that!"

Maybe my little explanation will save you the trouble.