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

Reading code

Reading code

As developers, we spend a lot of time learning to write code, while spending little to no time learning to read code. Meanwhile, we often spend more time reading code than actually writing it. Shouldn’t we be spending at least the same amount of time and effort improving this skill? Deliberate practice can help us get better at reading code. Learning how to better read and understand code, can in turn teach us what makes code readable. This might even help us to write code that is easier to read.

In this talk we will discuss the benefits of deliberately practicing reading code in a code reading club or session without an IDE, as well as common strategies to navigate a new codebase and familiarise ourselves with the code using the IDE.

Marit van Dijk

September 12, 2023
Tweet

More Decks by Marit van Dijk

Other Decks in Programming

Transcript

  1. Reading Code Introduction We read code when: • adding or

    changing functionality • fi xing bugs • understanding a new code base • doing code reviews • learning new technologies • etc.
  2. Reading Code Introduction "developers on average spend as much as

    58% of their time comprehending existing source code" - Felienne Hermans, The Programmer's Brain
  3. Reading Code Introduction • We spend more time reading code

    than writing code • But we don't practice reading code explicitly (much)
  4. Reading Code Introduction "How to teach programming (and other things)?"

    by Felienne Hermans https://www.youtube.com/watch?v=g1ib43q3uXQ
  5. Reading Code Agenda • The bigger picture • Understanding a

    codebase • and it's context • Down to the details • Find a place to start • Search • Navigate from there • Understanding a speci fi c piece of code • Hints from your IDE • Exercises for deliberate practice
  6. Reading Code The bigger picture • Draw your own diagrams

    • Write down questions (and fi nd answers) • Write down suggestions (maybe)
  7. Reading Code The bigger picture Strategies: • Identify components •

    Identify relationships / dependencies • Identify concepts
  8. Reading Code The bigger picture But fi rst: • Check

    out the code • See if you can build it
  9. Reading Code Understanding a piece of code • Structured exercises

    • Code Reading Club Starter Kit • The Programmer's Brain - Felienne Hermans
  10. Reading code Summary • Clone & build project • Components

    & Concepts • Relationships / Dependencies • Find a place to start • Search • Navigate • Find a way to start • Structured exercises • Syntax • Structure / Restructure • Behavior • Context