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

 

German elections: Centre-left narrowly wins against Merkel's party (27 Sep 2021)

 

German elections usher in political change with a small 'c' (27 Sep 2021)

 

COP26: Australia PM undecided on attending crucial climate summit (27 Sep 2021)

 

Swipe left or right? Germany's election dating game, explained (27 Sep 2021)

 

Afghanistan: Taliban ban Helmand barbers from trimming beards (26 Sep 2021)

 

Interviewing the Taliban: 'Still now I am terrified' (26 Sep 2021)

 

Fuel supply: UK suspends competition law to get petrol to forecourts (27 Sep 2021)

 

Power outages hit homes in north-east China (27 Sep 2021)

 

Iceland misses out on female majority after recount (26 Sep 2021)

 

San Marino votes to legalise abortion in referendum (26 Sep 2021)

more »

 

SF Gate

 

13 Best Background Check Sites & Services: Search Criminal Records and Social Media Accounts Online (28 Jul 2021)

 

It pays to search for top-quality auto shop (6 Feb 2021)

 

Fired Boeing CEO is now working with Bay Area tractor startup (14 Dec 2020)

 

PG&E bills to rise over per year on average to fund wildfire risk reduction (5 Dec 2020)

 

Nasdaq seeks more diversity on boards of companies listed on exchange (2 Dec 2020)

 

Elizabeth Holmes Prosecutors Say Texts Show Theranos Beset With Problems (24 Nov 2020)

more »


Site feed Updated: 2021-Sep-23 00:00