Cooking while Programming

Software metaphors

As Steve McConnell mentioned in his famous book “Code Complete”, Metaphors help you understand software development process by relating it to other activities you already know about. In his book, he vividly illustrates subtle differences between bad, good and better metaphors. I too agree with him on “building” (like in construction industry) a software as it implies various stages of planning and execution that vary in kind and degree depending on what is being built. I also enjoyed reading oyster farming and its relation to incremental software development. In this article I have tried to relate software to cooking and in that attempt wishing that my Mom understands what I do at work.

Why cooking?

First motivation to choose cooking is the interest I had (yes, past tense:) in it when I was a lonely bachelor hosting lunch (during weekends) and dinner to my colleagues and friends. I could relate the joy I obtained when the food turned out well and was enjoyed by the people who visited me to the joy of my code or product being used by customers. I even saw a similar joy in my mom’s face when my brother and I hogged her food. On the other end, I could also relate the dejection I experienced with my own food to various defects any other person found in my software.

Second motivation is the various scale of cooking that I could relate to Software development. It ranges from cooking for oneself, to cooking for dear ones at home, to guests at a family function and cooking for a function that extends beyond the family circle (I mean here events like a South Indian wedding that lasts for 2 to 3 days).

Third motivation is the kinds of setup under which a cook prepares food. When we prepare food at home we cook for ourselves. For a bigger function we either seek the service of a caterer to prepare food as per our interests or order food from any of the restaurants or food outlets.

Final motivation that gave me confidence was when I saw various books ending with “cookbook”, like HTML cookbook, Java cookbook, etc then I thought this idea is not going to be too absurd and foolish.

From Home to Caterers to Retail Outlets

Whenever I was alone at home and cooked, I never bothered how I cooked. I am fine as long as it fills my stomach. I can relate this to the assignments I did during my under graduation. As long as it gave the necessary output that my professor asked in the assignment I was happy to submit it.

A bit more elaborate process when we cook for our dear ones at home. As people at home are usually forgiving (some exceptions still exist 🙂 to the short comings in the food, we tend to take it easy again on the exact cooking procedure that assures good food at a higher probability. I could relate this to intranet or internal applications developed in house. Again, some internal customers are very demanding and they insist on a full fledged elaborate software to be developed with strict adherence to all the standard processes.

When we come out of our sweet home and start delivering goods and services to others as part of our business, it is no longer a cake-walk. It is going to be a serious business. If we just put ourselves in the role of a caterer cooking for a South Indian wedding, we expect our customer to be delighted with our service matching or exceeding his requirements. We wish to take pride and get that elation when a guest who had our food comes to us or our customer and tells “Amazing food, really delicious and great service too!”. We also expect this great work to spread through words of good references that fetch us next set of customers. All sounds exciting, but how can we as a caterer achieve this? Will the cooking style we used in the above two setups fetch us this glory. If you are with me on this article till now then your answer should be an unanimous big “No” for this question. Right from estimation, planning, preparation till execution and delivery, we should adopt a methodical organized approach that assures (if not, at least a higher probability) of success. I can relate the service a caterer provides to the software we develop as per customer specified requirements.

A retail outlet (consider restaurants and manufacturers of packaged foods) too expects a similar kind of glory through their customers. They always wish for the demands on their products to increase. On the contrary, a retail outlet does not prepare food based on the requirements of a single customer. It generates requirements based on what people in that area look for, their individual expertise in preparing those food and their knowledge of retail outlet industry. We expect new food items or products (through innovations or creativity) to come from an outlet set up. Being the owners of what they produce, they take pride of what they produce on one hand and on the other hand they become more answerable to a larger set of diverse customers. How many of us read through or at least notice various details that are presented along with the product. It ranges from simple manufacturing and expiry date / time to full fledged ingredients, calorie chart, cooking or eating tips (like appropriate side dishes or toppings), etc. I can relate this retail outlet setup or packed foods manufacturers to a product development setup in the software industry.

Preparing to cook

Take for example, a guest has come to my home and I am planning to offer him a cup of tea. To ensure that the effort that I am going to put in doesn’t get wasted and instead should impress the guest, I will have to ask him if he likes tea in the first place, if yes then I will have to understand his or her specific preferences – green tea or black tea or with milk, if with milk should it be thick (more of tea, less of milk) or light, with sugar or without sugar, very hot or mild hot, etc. For a simple cup of tea itself there are so many details that need to be understood from a customer point of view, then imagine the level of detail we need to go into the requirements of some large scale preparation.

Before we begin cooking we need to first understand what we are going to prepare. To enthrall the customers’ taste buds it is very important to gather all their expectations. The most critical part is to analyze and dig out those expectations that are not obvious. For example what is the level of spice the customers would prefer, any specific set of items that should not be used in the cooking like garlic, mushroom (yes, I don’t like them), how it needs to be presented & served, etc.

I am sure you agree with me on the fact that it is always better to clarify all doubts we have on menu or requirements upfront before starting to cook rather than customer pointing it out after he starts eating the food. It is going to be costly in terms of time, effort and money if any changes have to be made in the menu or if some flaw in the prepared food is found out at the end. Some costly mistakes will even make the food inconsumable or wasted. The cost of change increases as we proceed with cooking – later the change arrives more is the cost to do that.

Similar to this aspect, when we build software we need to understand all the requirements that the final package has to meet. Some will be explicitly stated by the customer, some will be implied and some will have to be dug out through a thorough analysis of requirements.

Now, let us take the case of cooking something new or something that we are not used to or to identify the mistakes or shortcomings early so that we can fix them at a relatively less effort and cost. Take for example, we are cooking dhal fry (an Indian dish) for the first time. The first step is to boil dhal (a type of yellow pulses). It is better to check if the dhal has boiled well at the end of this step before adding it to the rest of the mix of dhal fry that are cooked separately. We will not be comfortable in digesting all the requirements and procedure in a single step especially when we are an amateur. In such a situation, what I think normally most of us do is cook step by step. We would like to check how at the end of each steps our dish has shaped-up and if “all is well” and at the same time prepare for the next step to be followed.

In Software development too, we have various forms of incremental or iterative development. Each form has its own way of defining what needs to be achieved and how in each step.

Before marriage, when my parents visited my wife’s place they were offered an Indian dessert called Kajar Halwa prepared by my wife. She wanted to ensure that she impresses my Mom. So, she did a couple of tries on her Mom to understand what it takes to prepare that dish before specially preparing it for my Mom. Imagine a case when a customer is not too sure about what he wants or even the previous case of cooking something new. Before actually developing the dish we have to deliver, we would like to experiment or try out or cook a sample for the customer. Customer might also use this strategy to assess how we cook. One thing that we need to set forth upfront is the objective that needs to be achieved at the end of such a trial. Sometimes we will have to be determined to throw away the food we tried and cook it afresh from scratch for the food to be delivered to customer.

We come across similar situations in Software development too where we have to either make our self comfortable on what we have to build and how to make our customers comfortable on what they want and how we build that. We sometimes use terms like prototyping or proof-of concept or piloting for the experiment or trial we do.

Estimating what we need

Let us take our previous example on Dhal fry. Let me think that my invitees have come home and waiting for the lunch to be ready. I am in the kitchen cooking this wonderful dish. Feeling guilty of making my guests wait and leave them alone, I go to them every ten minutes asking for 5 more mins. Every time I went I became more apologetic and shameful. After 20 minutes, I find that I forgot to buy curry leaves to garnish my dish. Then I run to the vegetable shop in the ground floor to get that. After 40 mins when the dhal fry is ready, even though it has turned out well, my face more prominently boasts an apologetic figure rather than a pride figure for making them wait. Do you think your guests will be equally patient next time or you want them to equate your 5 mins to 40 mins? How worse will it be if the same lapse is made in a formal setup where customers are in place of guests who have ordered Dhal fry?

Now comes the dire need to estimate cost (that includes list of all the items necessary for the dish to be cooked), time and effort required to prepare what we have to deliver. We will have to do this to tell our customer when he can expect his Dhal fry to be delivered and what price he has to pay.

Before we estimate cost, time and effort, we need to understand the requirements clearly. For example, to first find out how much Dhal fry needs to be prepared, we need to get the answers for the the following questions.

  1. How many people are expected to have the food
  2. What type of crowd is expected and there by determining what would be the average consumption of dhal among the people
  3. What type of dhal customer needs (especially customer’s special or specific requirements) or most of the customers would prefer (for retail outlets / restaurants) like more dilute / liquid, more of onions, less spicy, less salty, etc. This in a way will help us identify how much quantity of each of the ingredients would be required

In one of our family wedding we were discussing with the caterers before awarding the contract. The first thing that they try to understand and estimate is the overall size of the contract so the usual questions were: how many days the function is going to be held (usually in our type of wedding it will last anywhere between 1.5 days to 2.5 days), how many courses of food have to be provided (as some will mandate a mini meal or snack during the evening apart from the dinner), how many people are going to attend each of the course and finally the exact menu we have in our mind. Till the last part the caterer himself drives the conversation with a check list derived from his experience in conducting and / or observing such wedding party. Most of the questions will sound like “Do you want this or are you planning to do this?”. Some of the questions will even strike us with some of the tasks or details we have totally forgotten. Believe me, that is the time we start admiring and respecting the Subject Matter Expertise present in front of us in the form of caterer.

In Software too, we first try to understand the size of the software we are going to build. Things like – number of features customers are asking, how complex the processing logic are, how many screens, how complex each screen are, how many entities are managed by Software, how many external Software our system has to interact with, etc.

Once the caterer understood our need, he immediately gave an overall cost estimate along with the details what all responsiblities he will undertake and what is agreed between us on the menu and number of people who will attend. He doesn’t go into the details of how many quantities of dhal, wheat, rice, etc to be purchased, what is the rate of individual items in the market, etc. This can only be possible only if the caterer is well experienced in organizing this kind of wedding parties and seen what it takes to deliver and what is the profit margin they should get. Some caterer might use information he has collected from his past experience to arrive at a final figure. These data will tell the caterer how much it costed them to conduct similar wedding parties in the past, what were the assumptions that failed and resulted as a risk, how much margin he could get, etc.

While taking up Software projects, we too adopt a similar approach if we are familiar with the solution to the customer’s problem. Some of the adoptations have also got the name as Wideband Delphi. These techniques have included some more guidelines in them to ensure that the estimated is a well calculated, thought over gut feel estimate.

I don’t know much how the caterer is breaking his total estimated cost for the wedding party to each of the schedule he has to deliver. But I am guessing, he would allocate percentage of the total budget to each of them again based on his past similar experience and information he has collected on his and his team’s performance in the past. We call this approach of estimation as Top – down approach in Software estimation.

Sometimes for a small family function we do call our favourite cook and tell him what we want him to prepare. He will tell us what all are required to complete that job. We then took individual items in his list and put the estimate for each one of them. Included cook’s charges too. Then finally arrived at the overall estimate. We call this type of estimation as Bottom-up approach in Software estimation. The complete list of tasks / activities that describes the overall scope of what needs to be done is termed as Work Breakdown Structure. We normally use it as a starting point in our bottom-up approach.

Knowingly, with guilt, I am leaving the remaining part of estimation and planning that is done in Software as well as cooking. This normally covers how many people are required to complete the job in hand, what is their availability, which task is dependent on which task so that they are relatively ordered and finally a schedule that tells how every activity has to be performed in which order, by whom and at what time. We will then come to know how much time it is going to take to complete whatever we need to deliver.

Using ready-made goods

When I sit back and compare how my grand ma cooks, my mom cooks and my wife or me cooks today, there is a substantial change in the way we prepare our food. Lots of spices that my grandma hand picked and ground to make a rasam or sambar (typical South Indian gravy that people mix with rice and have) powder are now readily available as ready-made powders. We just read instructions written on the packet to make use of it and prepare rasam or sambar in a much lesser time and effort.

In Software too, it was taking a lot of time, effort and cost to build a website. Now all the components are readily available and it takes much lesser time to build the website and that too it is so intuitive that any amateur can make use of it. People have to assemble all the pieces together and start using them. We call these ready-made goods as reusable components, frameworks, packages, libraries, etc. Many such components are free of cost and they are often referred us open source software. When we consume or produce such components, we need to strictly follow or publish the interface specification or contract the component is bound to.

Keep mom and grand mom’s tips in mind

I still remember my conversation with mom during the days when I started cooking alone. She explained me the basic framework for cooking – heating the vessel, sorting the lentils, frying the vegetables, adding spices and frying, boiling the mixture with spices, adding the boiled stuff like pulses and boiled vegetables and finally garnishing. This basic principle helped me to cook various dishes. She also told me how to choose which vegetables to fry and which vegetables to boil. There are various common cooking tips or solutions that our ancestors have told us which we apply today to prepare various types of dishes.

In Software too, there are common strategies or approaches devised and advised for various problems having the same pattern. We call these strategies as design patterns, architectural patterns, application integration patterns, etc.

The main intent of having these patterns in every space is to not reinvent the same wheel when there is a proven solution for a similar kind of problem.

Time is over, Can we cook now?

When I set forth to right this article I never anticipated it to take this much time and this long. Finally we have reached a state where we are all set to cook. My grandma used to use ammikallu (a stone to grind or bruise things upon) to grind all the spices where as my mom brought in mixer grinder to grind the same in fraction of seconds and with very less effort. Think about a kitchen where devices are there to do all the cooking tasks at one place – right from washing the vegetables, to cut, to boil, to microwave, to clean the dishes, to exhaust the smoke etc to another kitchen where everything has to be done manually and at different places. I would compare a kitchen to Integrated Development Environment (IDE) Software that we most of us use to write a computer program or a commercial product.

The more organized the kitchen is the more easy for the cooking team to prepare the dish. When I mean organization of kitchen it is the arrangement or placement of all the things that are required to cook. Right from the placement of the gas stove to the place where dishwasher is kept help in the overall cooking process.

While building a Software proper organization of all configuration items in the repository and consistent integration & configuration of IDE in every Software Engineer’s system greatly assists in simplifying the construction part of the Software. Like how cook prepares food, we write programs or routines in any of the computer language to build the Software.

The more organized every member of the cooking team is the less is the confusion at the time of cooking. If every member of the team knows what he needs to give to others at what time, where to take things from, where to keep things back, which vessels to clean, when and how to talk to other people in the team most of the problem in cooking is solved. The only thing that will remain would be to do each one’s tasks correctly and completely and they verify the completeness before giving out what they have prepared.

While programming too we expect consistency and discipline in all the members of the Software development team. Every one should adhere to the agreed coding convention and standards, understand-implement-check-integrate their piece of code that conforms to the contract or specification stated at the time of planning (designing). We use the term unit testing to refer to the process of verifying ones own program for completeness and correctness.

If you look back at the history of Software development it is difficult to imagine how our previous generation programmers have managed to develop big applications without proper tools that are readily available today. I had given up many a times in the middle of this thought process. Though I am not too old to talk about history I will just compare what I used ten years back to complete my programming assignments to what I use today. I open VI editor type my programs, keep a book on the side to check the method signature & language syntax, use command line interface to compile a program as well as to execute it and repeatedly execute it . Now I use sophisticated IDE where all relevant tools are integrated or can be integrated through plugins. The productivity has multiplied N fold because of the advent of these tools and technologies.

Why are they poking their nose?

Let us imagine a stage portraying a cook preparing food with the mind set that he is the boss of kitchen and he knows everything to complete preparation of food. There comes a supervisor entering the kitchen and proceeding towards this cook. While the cook has not finished preparing the food, he has to respond to all the supervisor’s questions even though he doesn’t like it. Cook murmuring “I know what to do. I am taking care of everything. Don’t worry. Please allow me to finish it.” Some times a potential ego clash can also erupt. On the other hand, the Supervisor thinks “My managers have entrusted me this responsibility to ensure that all is well in the kitchen. As they are answerable to their customers, I need to do my duty to ensure that my Managers are well informed and they never land up in a state where they are taken by surprise. So let me find out from the cook if everything is taken care of”.

In Software industry too, we perform audits that are meant to identify the gaps in what is planned against what is being built so that relevant stakeholders are well informed. This enables people who are involved to address these gaps well in advance by taking appropriate corrective and preventive actions.

Oops, salt is more!

Now I managed to complete my part of cooking. I take a spoon full of Dhal fry (don’t get bored with my Dhal fry) and taste it. “My God! it is salty!”. According to me, fixing a defect in a food is more challenging to me than removing a bug (we call it this way) from the software. What do I do for the extra salt? Can I add more plain boiled dhal to the mix? Can I mix a paste of fried gram dhal to the mix? Or add more water and make the dhal dilute? I hate this situation. I should have added salt in steps. What if I have added more salt in one of the steps. But what to do. Can’t bear the shame of people criticizing my Dhal. Call up my Mom and ask her. Or hit the search engine on the browser and look for help. Somehow, I finally managed to get a better tasting Dhal fry.

Sometimes I don’t feel confident with my own taste buds. Even if I find the Dhal fry okay to pass it on to the dining table, I feel more confident to call the best connoisseur at home who critically comments on the food inside the kitchen and get his or her remarks.

In Software development too, we do various types of testing at various levels. A programmer first tests what he has written which we refer us unit testing. After successful testing of his unit he integrates his module with rest of the modules and performs integration testing to check if his module works in tandem with other modules to achieve the overall system objective. Finally we give the Software for overall System testing to Quality Assurance (QA) team or Independent Verification & Validation (IV&V) team who are considered experts in understanding what and how the Software has to perform.

Are we ready?

Once I went to a restaurant and ordered for a North Indian meal. After around 15 minutes there came a waiter carrying my North Inidan meal in a plate. When I got the plate, I came to know that a cup of gravy was missing. I brought it to his notice. He said “Sorry Sir. I forgot it. I will get it for you”. When I started to have food, I found that the spoons given to me were not washed. I called my waiter again and showed him the spoon, He said “Sorry, I didn’t check it. I will get you a fresh one.” Finally when I took the Roti to eat I found that it was charred. I called my waiter friend. This time I lost my patience to explain the problem. I just lifted the roti and showed him either side of it. I can notice the shame in his face. Just to save it, he added saying “Actually Sir, I made another Roti after seeing this charred Roti. But, while delivering the plate to you I accidentally took the old one and placed it on the plate. My bad. I am extremely sorry. Kindly excuse me”. Will you opt to come to this restaurant next time? Recently I went to a Pizza shop and ordered few pizzas for takeaway. Before they delivered the pack to me they took my order and a check list and started ticking each one of them as they go through the list. I then understood how these chaps don’t forget to keep any of the items consistently.

We normally relate this step in Software to Build & Release process. Many improvements and automation have taken place in this part. We do check if all the deliverables including for example user documentation, if promised are delivered along with the Software place. We check if all the promised features in the release are tested and cleared. Sometimes, we also randomly check to confirm if the system functions right. We ensure upfront that right versions of each of the artifacts are bundled in the version. Finally, a release note or document that puts all information and pointers related to the release. Most of the projects do have a release checklist that they use to review or audit the deliverables that are about to be delivered to the customer.

Enough of cooking

I guess I already crossed my limits of a blog article and provoked the readers to become impatient. Though thoughts of relating the process of obtaining customer feedback, change management, bug fixing, maintenance, quality accreditation, etc haunted me, I am leaving it here in order to avoid overdoing this comparison. So, enough of food for thought. Call me up and come home for a cup of tea and dhal fry self-cooked and served hot with warmth in the heart.



About Arunkumar Krishnamoorthy

Passionate Software Engineer and a Computer Science Engineer. Brave and responsible leader. Hands-on Solution Architect. Continuous learner.
This entry was posted in Software Engineering. Bookmark the permalink.

2 Responses to Cooking while Programming

  1. Parveen Mudgil says:

    Indeed a very good insigth 🙂

  2. Vikash says:

    Excellent Analogy….:)..i find it all the more interesting as my 2 fav. fields (cooking & software) occupy d center stage….Tis blog has whetted my appetite for knowledge…:)..:)

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s