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

TL;DR: Reading Code Is Harder Than Writing It

Trisha Gee
September 11, 2019

TL;DR: Reading Code Is Harder Than Writing It

It's funny that computer languages are the only languages where one learns to write before learning to read. It's actually not uncommon for people to never really learn to read code. This seems a little unbalanced given that we actually read code much more frequently than we write it.

Even those who promote software as a craft sometimes fall into the trap of often talking about writing clean code that people can read, yet not placing much emphasis on the skill of reading the code.

The ability to read code must also be a skill, and as such it must be something that can be learnt and practiced. In this presentation, we're going to look at:

- The different reasons we might have to read code, and how that should impact our reading
- The problems we face when reading code (even our own!)
- Tips to bear in mind when we're reading code
- Tools we can use to help our understanding
- How and where to practice these skills

At the end of the talk we will at least have considered whether we need to level up our "Reading Code" skill.

Trisha Gee

September 11, 2019
Tweet

More Decks by Trisha Gee

Other Decks in Programming

Transcript

  1. View Slide

  2. Room on the Broom by Julia Donaldson & Axel Scheffler

    View Slide

  3. View Slide

  4. View Slide

  5. View Slide

  6. View Slide

  7. READING CODE

    View Slide

  8. View Slide

  9. View Slide

  10. View Slide

  11. View Slide

  12. View Slide

  13. View Slide

  14. https://www.stilldrinking.org/programming-sucks
    “Every programmer occasionally, when
    nobody’s home, turns off the lights,
    pours a glass of scotch, puts on some
    light German electronica, and opens up
    a file on their computer. They read
    over the lines, and weep at their
    beauty….”

    View Slide

  15. View Slide

  16. View Slide

  17. View Slide

  18. View Slide

  19. View Slide

  20. View Slide

  21. View Slide

  22. https://www.stilldrinking.org/programming-sucks
    “This file is Good Code. It has
    sensible and consistent names for
    functions and variables. It’s
    concise. It doesn’t do anything
    obviously stupid…. It reads like
    poetry written by someone over
    thirty.”

    View Slide

  23. View Slide

  24. View Slide

  25. View Slide

  26. View Slide

  27. View Slide

  28. View Slide

  29. View Slide

  30. View Slide

  31. View Slide

  32. View Slide

  33. View Slide

  34. View Slide

  35. View Slide

  36. View Slide

  37. View Slide

  38. View Slide

  39. View Slide

  40. View Slide

  41. Badass: Making Users Awesome
    Kathy Sierra
    “After enough exposure with feedback, your
    brain began detecting patterns and underlying
    structures, without your conscious awareness.
    With more exposure, your brain finetuned its
    perception and eventually figured out what
    really mattered. Your brain was making finer
    distinctions and sorting signal from noise
    even if you couldn’t explain how.
    It was just your brain learning...
    without bothering you with all those pesky
    details”

    View Slide





  42. View Slide

  43. View Slide








  44. View Slide

  45. View Slide

  46. Twelfth Night
    William Shakespeare

    View Slide











  47. View Slide

  48. View Slide

  49. View Slide

  50. Twelfth Night
    William Shakespeare
    If music be the food of love, play on,
    Give me excess of it; that surfeiting,
    The appetite may sicken, and so die.

    View Slide

  51. The Canterbury Tales, and Other Poems
    Geoffrey Chaucer
    Whylom, as olde stories tellen us,
    Ther was a duk that highte Theseus;
    Of Athenes he was lord and governour,
    And in his tyme swich a conquerour,
    That gretter was ther noon under the
    sonne.

    View Slide








  52. View Slide

  53. View Slide

  54. View Slide

  55. View Slide

  56. View Slide

  57. View Slide

  58. IDE Navigation
    https://youtu.be/1UHsJyCq1SU

    View Slide

  59. View Slide

  60. Everything Bad is Good for You: How Popular Culture is Making Us Smarter
    Steven Johnson
    “If you don't think about the
    underlying mechanics of the simulation—
    even if that thinking happens in a
    semiconscious way—you won't last very
    long in the game. You have to probe to
    progress.”

    View Slide





  61. View Slide

  62. View Slide

  63. “The game scholar James Paul Gee breaks
    probing down into a four-part process,
    which he calls the ‘probe, hypothesize,
    reprobe, rethink’ cycle”
    Everything Bad is Good for You: How Popular Culture is Making Us Smarter
    Steven Johnson

    View Slide

  64. View Slide

  65. View Slide

  66. Good Omens
    Neil Gaiman & Terry Pratchett
    “It may, or may not, have helped
    Anathema get a clear view of things if
    she’d been allowed to spot the very
    obvious reason why she couldn’t see
    Adam’s aura. It was for the same reason
    that people in Trafalgar Square can’t
    see England.”

    View Slide










  67. View Slide

  68. View Slide

  69. View Slide

  70. View Slide

  71. View Slide

  72. The Giant of Jum
    Elli Woollard & Benji Davies
    “I’m grizzly and grumpy
    and grouchy and grumbly
    I’ve not been called lovely before!”

    View Slide

  73. View Slide

  74. View Slide

  75. View Slide

  76. View Slide

  77. Clean Code: A Handbook of Agile Software Craftsmanship
    Robert C. Martin
    “Indeed, the ratio of time spent
    reading versus writing is well over 10
    to 1.”

    View Slide

  78. “Indeed, the ratio of time spent
    reading versus writing is well over 10
    to 1. We are constantly reading old
    code as part of the effort to write new
    code. ...[Therefore,] making it easy to
    read makes it easier to write.”
    Clean Code: A Handbook of Agile Software Craftsmanship
    Robert C. Martin

    View Slide

  79. View Slide

  80. View Slide

  81. View Slide

  82. Pride & Prejudice
    Jane Austen
    “My fingers,” said Elizabeth, “do not
    move over this instrument in the
    masterly manner which I see so many
    women’s do. They have not the same
    force or rapidity, and do not produce
    the same expression. But then I have
    always supposed it to be my own fault —
    because I will not take the trouble of
    practising. It is not that I do not
    believe my fingers as capable as any
    other woman's of superior execution.”

    View Slide

  83. View Slide