I have enjoyed Lakoff and Johnson's classic book Metaphors We Live By. Originally published in 1980, they argue that metaphor is not simply a literary device. Instead it is a fundamental way the human mind makes sense of the world, by using knowledge in one domain to reason about another domain. The use of metaphor is pervasive in our throught, whether we are aware of it or not.
Once I learned how to look, I started to see our use of metaphor everywhere. For example, we describe a computer program execution (a job) as a life object.
- The job is created
- The job uses a lot of memory
- Is it still alive?
- It is frozen
- Kill the job
A faulty computer program is said to have a bug. A job as a programmer is to find bugs and remove bugs from software.
Data Structures are often conceived metaphorically. We have data structures like stacks (e.g. a stack of paper), queues, trees, and dictionaries, etc. Tree is a special metaphor. It is structurally similar to a biological tree. It has many branches and each branch has more sub-branches. On the other hand, we don't use other parts of the metaphor such as that tree is a living object that breathes and requires nutrition. Instead, all these data structures use the container metaphor. We put things into them and we take things out.
Computer science is often abstract in nature. We map abstract ideas into familiar concepts using metaphors. The mechanics of a "pointer" is a number used as the memory address of another data of interest. Instead of thinking about the mechanics, we conceive the pointer as an arrow that points to the referenced item. The pointer metaphor makes this much easier to make sense of.
2021.07.24 comments