I am often asked by non-programmers to explain what I do and how I do it. Following is my answer.
I am a programmer and, like many others in my profession, I am a nerd.
"Wonderful thing with nerds: they're enthusiasts. Not having a life means you get to love things with a passion and nobody bothers you about it." - John Burnside
Many think that computers are really smart. They are not. They are as dumb as it can be. What they excel at is crunching numbers very quickly. They do not know how to think or reason. They do exactly what we tell them.
The job of a programmer is to translate real-world problems into numbers that computers can understand. A computer is like a child that will do everything you tell him to do. What you want him to do is irrelevant; the only thing that matters is what you tell him.
On rare occasions when my daughter does actually listen to me, our relation is similar to the one of a computer and a programmer. I'm trying to make her do something and she's testing my patience by doing what I tell her to do instead of doing what I want her to do.
"Get in the shower. Turn on the water. Please use soap. On your body, not the walls. Use shampoo, it goes in your hair. Rinse it all off with the water coming from above you, not from the toilet. Turn off the water. Dry off with the towel. Go to bed."1 The result is a child that took the shower in her clothes. No one told her to get undressed first.
Computers act in a similar way. They follow instructions blindly. If instructions are not precise enough or if there are some steps missing, it is the fault of the programmer for not being clear or detailed enough.
There are two major models used to develop software: waterfall and agile.
The waterfall model tries to plan everything in advance, execute that plan and observe the result at the end of the process. It assumes that the plan is perfect and leaves no margin for errors. It's an all or nothing approach. Failure or success. In the waterfall model, a parent would plan everything from the shower to the bed and once the plan is finished execute it by giving instructions to the child. He would wait until the whole process is finished and look at the final result. He would find the child in bed, sleeping in sopping wet clothes. Mistakes are realized late and corrective actions are very expensive to make. The end result: child is sick. Corrective action: new bullet-proof plan. "Call the taxi, get the child to your arms, open the front door, lock the door behind you, go down the stairs, enter the taxi, instruct the driver to go to the hospital, wait until the car is in front of the hospital, get out of the taxi, find the doctor, explain the situation, cure the child, go back home". Unfortunately, you realize that the plan is not perfect when the doctor asks you "why is this child still in wet clothes?"
The agile model realizes that there is no perfect plan. It puts a lot of emphasis on learning from mistakes and adaptation. It embraces unavoidable uncertainty. Instead of planning everything in advance it breaks the work into small pieces called iterations. Each iteration should produce a small but fully completed functionality. In the agile model, a parent would not know what all the detailed steps from shower to bed are. He would simply know the high level goal (fall asleep clean) and start with the first step. He would instruct the child to "get in the shower". Once the child is in the shower he would observe the result, realize that the clothes are still on and adapt to this new situation by instructing the child to take her clothes off. Unlike the "waterfall child" that probably ended up in the intensive care, the "agile parent" realized his mistake early and did what it takes to correct it.
We never manage to make computers do what we want from the first attempt. It is too complex to do it in one go so we break the work into small pieces. We write the code that performs one unit of work, test it, and, if it worked as expected, integrate it with the rest of the units. We evaluate results often and adapt our plans. We put emphasis on continuous communication. By we, I mean some of us. Unfortunately, many companies still prefer the waterfall process. Their child is either clean sleeping in her bed or in intensive care.
To summarize, programmers are nerds, computers are dumb, and my daughter is clean and dry.
- Paraphrased from one of Bill Cosby's shows. ↩