tungwaiyip.info

home

about me

links

Blog

< July 2021 >
SuMoTuWeThFrSa
     1 2 3
4 5 6 7 8 910
11121314151617
18192021222324
25262728293031

past articles »

Click for San Francisco, California Forecast

San Francisco, USA

 

Metaphor in Computer Science

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

 

 

blog comments powered by Disqus

past articles »

 

BBC News

 

Prague gunman killed himself on roof as police approached (22 Dec 2023)

 

Bodycam footage shows police hunting Prague gunman (22 Dec 2023)

 

Alex Batty: Police launch abduction investigation into disappearance of British teen (22 Dec 2023)

 

Banksy stop sign drones art removed in London (22 Dec 2023)

 

Martin Kemp refunds disabled ticket after fans' difficulty with seller (22 Dec 2023)

 

Queues at Dover as Christmas getaway begins for millions (22 Dec 2023)

 

New £38,700 visa rule will be introduced in early 2025, says Rishi Sunak (22 Dec 2023)

 

UK at risk of recession after economy shrinks (22 Dec 2023)

 

Mohamed Al Bared: Student jailed for life for building IS drone (22 Dec 2023)

 

Andrew Tate denied request to visit ill mother in UK (22 Dec 2023)

more »

 

SF Gate

more »


Site feed Updated: 2023-Dec-22 09:00