DEV Community

Cover image for A long-lasting love of Programming Metaphors

A long-lasting love of Programming Metaphors

mark_nicol profile image Mark Nicol ・3 min read

Picture Credit: The Evil Queen from Disney's Snow White and the Seven Dwarfs, Art Babbit (animation) Walt Disney & Joe Grant (design) via Wikipedia Fair Use with full attribution there. Used to illustrate Paul Heckel quote.

The first real book I remember reading on 'how to program' was Code Complete by Steve McConnell. It was lent to me by one of my first mentors. I enjoyed it so much I went out and bought a copy of the then new expanded edition Code Complete 2.

Before that, all the books I had read were either about how the hardware and software worked together or explaining how to write programs using a particular language syntax. There might be a few good points about writing comments or how to structure your code but they were few and far between and you had to look for them amongst the text.

Code Complete was different. Within the first couple of chapters, it introduces the concept of metaphors.

"Important developments often arise out of analogies. By comparing a topic you understand poorly to something similar you understand better you can come up with insights that result in a better understanding of the less familiar topic "

(Code Complete 2, p.9)

After lots of examples from other fields, he ends with a useful metaphor for metaphors.

"A software metaphor is more like a searchlight than a roadmap. It doesn't tell you where to find the answer. It tells you how to look for it. A metaphor serves more as a heuristic than an algorithm."

(Code Complete 2, p. 11)

He then gives a long list of metaphors that have been used in the past.

"A confusing abundance of metaphors has grown up around software development. David Gries says writing software is a science (1981). Donald Knuth says it's an art (1998). Watts Humphrey says it's a process (1989). P. J. Plauger and Kent Beck say it's like driving a car, although they draw nearly opposite conclusions (Plauger 1993, Beck 2000). Alistair Cockburn says it's a game (2002). Eric Raymond says it's like a bazaar (2000). Andy Hunt and Dave Thomas say it's like gardening. Paul Heckel says it's like filming Snow White and the Seven Dwarfs (1994). Fred Brooks says that it's like farming, hunting werewolves, or drowning with dinosaurs in a tar pit (1995). Which are the best metaphors"

(Code Complete 2, p.13)

What was nice today was that two authors wrote very different, but very lovely pieces - both with there own very personal metaphors for learning, that I hadn't seen before.

It really made my commute so much nicer - and like McConnell's spotlight, for me, they both shone a different light on this messy process of learning how to be a better developer.

What are other people's favorite metaphors either for programming or for learning, or for learning about programming?

Discussion (3)

Editor guide
rpalo profile image
Ryan Palo

Thanks for the shout out :)

mark_nicol profile image
Mark Nicol Author

Pleasure - I really enjoyed the article

lvrbrtsn profile image
Levi ᕙ(⇀‸↼‶)ᕗ

Hey! Thanks! Glad I could help with the commute!