Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Metaphors We Code By (Software Architect 2015)

Nat Pryce
October 15, 2015

Metaphors We Code By (Software Architect 2015)

Of the 12 XP practices that Kent Beck described in the “white book”, System Metaphor has seen little adoption while the others have been enthusiastically embraced and extended. In this presentation I explored why this might be so, and related XP’s notion of metaphor to conceptual metaphors that has been investigated by George Lakoff et al.

Lakoff’s research indicates that metaphors are inescapable when thinking and communicating about software. However, careless use of metaphor can hinder the process of designing software and communicating about software design. If we cannot avoid metaphor we must use it to our advantage and avoid its pitfalls.

Presented at Software Architect 2015, London, UK.

Nat Pryce

October 15, 2015
Tweet

More Decks by Nat Pryce

Other Decks in Programming

Transcript

  1. Metaphors We Code By or What we talk about when

    we talk about software Nat Pryce [email protected] @natpryce github.com/npryce
  2. “Each XP software project is guided by a single overarching

    metaphor. Sometimes the metaphor is "naive". ... Sometimes the metaphor needs a little explanation. The words used to identify technical entities should be consistently taken from the chosen metaphor. As development proceeds and the metaphor matures, the whole team will find new inspiration from examining the metaphor.” eXtreme Programming Explained, Kent Beck, 1999 The White Book
  3. [System Metaphor is] “What XP uses to unify an architecture

    and provide naming conventions. A simple shared story of how the system works, a metaphor. This story typically involves a handful of classes and patterns that shape the core flow of the system being built.” http://c2.com/cgi/wiki?SystemMetaphor as of 25/04/2014 The C2 Wiki
  4. “System Metaphor is itself a metaphor for a simple design

    with certain qualities. The most important quality is being able to explain the system design to new people without resorting to dumping huge documents on them. A design should have a structure that helps new people begin contributing quickly. The second quality is a design that makes naming classes and methods consistent.” http://www.extremeprogramming.org/rules/metaphor.html as of 25/04/2014 Ron Jeffries’ Current Description of XP
  5. Example: MORE IS UP From The Guardian website, 15/05/2014: “OVO

    Energy raises prices 3%” “...soaring values have revived idea of selling part of property portfolio...” “...nation's top 10% owning 44% of household wealth...” “Ministry of justice figures show number of convictions fell by only 69...” “Labour's nosedive in the opinion polls…”
  6. A Layered Architecture Diagram Hardware Device Drivers Operating System Application

    Hardware Device Drivers Operating System Application Or? Which feels right?
  7. Mapping onto Different Target Domains Up Down etc. More Less

    Happy Sad Pure Corrupt Abstract Concrete People Animals Controlling Controlled
  8. Vertical Orientation ABSTRACT IS UP CONTROL IS UP PEOPLE IS

    UP HARDWARE IS DOWN (STATIC) DEPENDENCIES POINT DOWNWARDS ...
  9. Types of Conceptual Metaphor One thing for another, physical for

    abstract Up/Down, Near/Far, Facing towards/away Large/Small Inside/Outside, Boundary, Surface Extent, Covering, … Light/Heavy Bright/Dark ... Ontological Orientation Size Containment Surface Weight Shade ...
  10. Containment PROGRAMMING LANGUAGES ARE CONTAINERS CONTROL AT THE CENTER VULNERABLE

    IN THE CENTER “The system is in Java” Encapsulation Hexagonal Architecture Privilege ring levels ...
  11. User-facing features Front-end developer Database back-end Externally facing services ...

    Orientation: Facing Towards Something THE SYSTEM FACES THE USER THE SYSTEM FACES OTHER SYSTEMS
  12. Size Big Data “Big Iron” (mainframes) Software design diagrams could

    make better use of BIG IS IMPORTANT BIG IS IMPORTANT BIG IS POWERFUL
  13. Entailment and Coherence Read: “Following the report, shares in XYZ

    Plc took a nosedive and were in freefall by close of trading.” Think: “I should bail out of my investment in XYZ Plc. before the stock hits rock bottom.”
  14. Database ORM Domain Model UI Or? Which feels right? Database

    ORM Domain Model UI Inadvertent Entailment: Layers, Balance, Size
  15. E.g. Tiers vs Layers Similar in real life Different technically

    Often conflated Image CC-BY-NC-ND 2.0 THEMACGIRL* Inadvertent Mixed Metaphors
  16. Another Example: ARGUMENT IS WAR From The Guardian website, 17/05/2014:

    “Sussex police under fire for 'criminalising' fracking protests” “Nigel Farage has attempted to defend his controversial remarks...” “Michael Gove ordered to seal truce as Clegg hits back...”
  17. Example: AN ARGUMENT IS A BUILDING “Alice's argument is supported

    by recent research.” “The foundations of Bob’s argument are rather shaky.” “Carol has put together a convincing case.”
  18. ARGUMENT IS WAR AN ARGUMENT IS A BUILDING “To demolish

    my opponent’s argument I should undermine it by attacking its weak foundations.” Coherence Of Argument Metaphors
  19. Metaphorical Blinkers Image CC-BY-SA 2.0 Pete Markham Metaphors We Live

    By, Lakoff and Johnson, 1980. “In allowing us to focus on one aspect of a concept, a metaphorical concept can keep us from focusing on other aspects of the concept that are inconsistent with the metaphor.”
  20. Figurative / Unconventional Metaphor Metaphors We Live By, Lakoff and

    Johnson, 1980. “...in getting us to try to understand how it could be true, it makes possible a new understanding…”
  21. Idioms: Metaphors that have Kicked the Bucket Figurative metaphors can

    become common phrases in language When we forget the original meaning of the phrase, it loses its explanatory power. The phrase fossilises as an idiom
  22. Summary ❖ Metaphor is inescapable ❖ Metaphor can help and

    hinder ❖ Be mindful of how we use metaphor