“Begin with the end in mind” Stephen R. Covey
Imagine a customer asked you to make a ‘cup of tea’. Also imagine that you don’t already know how to make a cup of tea. Or even what a cup of tea is.
How do you go about making that ‘cup of tea’?
This could be analogous for so many complex problems. An ambiguous outcome, with no know process for getting there.
You do have certain tools at your disposal. You are in a kitchen. The kitchen is well stocked. You know how to use kitchen appliances.
Oh, and let’s assume, for this thought experiment, that the customer requesting the cup of tea is very patient…
So, now, how do you go about making that ‘cup of tea’?
What if we were to apply test driven development? And then test and learn our way to a ‘cup of tea’?
So what do we know? We know we need a ‘cup’, and we know we need ‘tea’. You look around the kitchen, you find a mug, and you find a pot labelled tea. You remove the funny looking little bag and put it in the mug. You present this to your patient customer….
“Yes, that is a cup with tea in it. But it’s supposed to be a drink”
Ok, a drink you think. A drink needs be made of liquid. What is a liquid? Water is liquid. So you add some water to the mug with a tea bag in it.
“Ok, yes, that is some cold tea, and I could drink that, but I want my tea to be warm and comforting.”
Ok, getting closer, it is now something that could be drunk, but it needs to be ‘warm and comforting’. How do you heat water up? You know that. You can put cold water in the kettle to heat it up. So you empty the mug, place a new tea bag in it, and add hot water from the kettle.
“Wow, ok the tea is too hot now. You need to add a splash of cold milk to cool it and smooth the flavour.”
Right, ok, closer still. You add a tea bag to a mug, add hot water from the kettle, then a splash of milk from the fridge. Perfect, right?
“Ah, lovely. A warm milky tea. My favorite… Bluergh, what’s this? You’re supposed to take the tea bag out as well!”
Ok, ok, tea bag in mug, add hot water, from kettle, splash of milk, remove tea bag. A cup of tea.
This example is a bit trite. But it serves the purpose of giving a simple scenario of how starting with the end in mind with the simplest formulation of the requirements as possible. And, then, using iterative test cycles, building a solution that ultimately met the customers needs.
Test driven development in practice. The value of working backwards.