Metaphors in Software

April 7, 2020   • development

By comparing a topic you understand poorly to something similar you understand better, you can come up with better insights about the poorly understood topic. Metaphors help us understand the software development process by relating it to other activities we already know about.

A metaphor is different from an algorithm in the sense that it’s more like a searchlight than a road map. It doesn’t tell you where to find the answer, but rather how to look for it. Metaphors give us insight into programming problems and processes and help us imagine better ways of doing things and solving problems.

In his book Code Complete, Steve McConnell compares software development to various metaphors, including writing, farming, and construction.

Software development is like writing. How do you write well? You write something and rewrite, and rewrite again. The same goes for programming. You write the first draft of the program to make it work. Then you rewrite it to make it better. Then you rewrite it to optimize and make it beautiful. Like well-written prose, a well-written program is readable.

Software development is like farming and gardening. When we are writing code, we are planting seeds and growing crops. You design, code, test, and add it to the project a little bit at a time.

Iteration is another metaphor that applies well to software development. Incremental designing, building and testing and iterating are some of the most important activities in software development. You first make the simplest possible version of the system that will run. Then you iterate to make it better.

Finally, software development is building construction. In my opinion, this is the fittest metaphor that applies to development. Building software is similar to construction in so many ways. Many common terms in software development derive from the building, such as software architecture and architect, scaffolding, construction, etc.

However, no one metaphor rules them all. There is no silver bullet. Many consultants tell you to buy certain methods to the exclusion of others. This usually doesn’t work because you suffer from the man-with-a-hammer syndrome and miss opportunities to use other methods better suited to your problem.

From: Code Complete by Steve McConnell