[VDBUH2024] - Marit van Dijk - Reading code

Learn effective code reading techniques to improve understanding, maintenance, and modification of code. Discover how to build mental models, use IDE features, and create memory aids to simplify complex code and foster a sense of community.

Key takeaways
  • We spend more time reading code than writing code, and understanding code is essential for maintaining and modifying it.
  • To read code effectively, first understand the problem and identify relationships and dependencies.
  • Use IDE features like code formatting, searching, and navigating to help with code reading.
  • When encountering unfamiliar code, start by building a mental model of how it works.
  • Identify important lines of code, concepts, and context to aid understanding.
  • Create a list of unknowns to research and address them.
  • Use memory aids like dependency graphs and state tables to simplify complex code.
  • Run tests and debug code to gain a deeper understanding.
  • Draw diagrams and extract meaningful names from code to aid comprehension.
  • Recognize that code reading is a process that involves suspending judgment and focusing on understanding.
  • It’s essential to maintain a mental model of the code base and context to aid in future development and maintenance.
  • Our short-term memory can only hold a limited amount of information, so use memory aids to supplement understanding.
  • Use code reading as an opportunity to learn from others and build a sense of community.
  • Even with an IDE, code reading involves navigating complex structures and identifying relationships.