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

August 31, 2023
Tweet

More Decks by Marit van Dijk

Other Decks in Programming

Transcript

  1. Reading Code Introduction "developers on average spend as much as

    58% of their time comprehending existing source code" - Felienne Hermans, The Programmer's Brain
  2. Reading Code Introduction We read code when: • onboarding to

    a new project • adding or changing functionality • fi xing bugs • doing code reviews • reading books, blogs, ... • etc.
  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 • Di ff erent strategies / approaches

    for di ff erent tasks • With & without your IDE
  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 Strategies: • Identify components •

    Identify relationships / dependencies • Gain background knowledge
  7. Reading Code The bigger picture But fi rst: • Check

    out the code • See if you can build it
  8. Reading Code The bigger picture • Draw your own diagrams

    • Write down questions • Write down suggestions (maybe)
  9. Reading Code Down to the details • Draw your own

    diagrams • Write down questions • Write down suggestions (maybe)