On March 13, Azul gathered Java developers, enthusiasts, and Java Champions to celebrate 30 years of Java. An impressive lineup of luminaries gave presentations, including Developer Advocate Marit Van Dijk. Marit discussed how developers learn how to write code and how to write code to be readable, but not as frequently how to read code. In this presentation she gives some helpful tips and tricks for reading code to best understand and use it.
Developers spend more time reading code than they do writing it, but they don’t practice reading code very much, or at least not explicitly. Marit Van Dijk, developer advocate at JetBrains, made these opening remarks in her Duke Turns 30 session, Reading Code. And she wants to do something about it.

According to The Programmer’s Brain, a book by Fauci University Computer Science Professor Felienne Hermans, developers spend as much as 58% of their time comprehending existing source code. And while developers learn to write readable code, they rarely learn to read code properly.
To underscore the point, Marit described 1992 research in which a class was learning programming, and they split the class into three groups.
- The first group wrote code and read code.
- The second group wrote code and read code with an explanation of choices that were made, like why a certain implementation was chosen.
- The third group read the code with those explanations.
The second and third group that read the code with the explanations were able to reproduce the programming concepts that they were learning more accurately than the first group that just wrote code.
That research inspired Marit to get involved in a code reading club, and she devoted the rest of her presentation to explaining some of the exercises and best practices from the club.
First glance
With this exercise, developers take one minute to look at a piece of code and write down the first thing that they notice about it and why. Other exercises follow, like identifying the five most important lines in the code.
“And what we found was that gradually we would converge on what we all thought were the most important lines,” Marit said. “But especially at first, it’s really interesting also to see why people select certain lines as the most important and finally, we might identify concepts that the code deals with, and because we had such a diverse group with different backgrounds, usually someone in the group would be able to explain those things, even if they were unfamiliar to others.”
Some people would ignore certain parts of the code or would focus on other parts, and Marit enjoys seeing how people find different components interesting, depending on their experiences.
Research lists
Marit noted that people sometimes find code confusing because they lack knowledge about the programming domain language or the business domain. “We can deal with this lack of knowledge by creating a list of the things that we don’t know and researching them,” Marit said. “And if there is information that is relevant for action for us to actually know by heart, we can memorize it.”
New code familiarity
When a new person joins a team and starts getting familiar with the codebase, Marit recommends explaining to the person why the code was developed the way it was from both a technical perspective and a business perspective. The best way to do that is in the IDE. She recommends having a helpful README for the code, possibly pulling XML, and using a tool like Gradle to check dependencies.

Another strategy for familiarizing a person with an application is looking at a slice of it. A person could lose her place in the code, so Marit suggests a few strategies for getting around this problem:
- Use recent files to recent files to see recently visited files and recently edited files
- Use recent locations to go to a specific point in a file
- Add bookmarks to lines in the code
- Use or draw diagrams to visualize code files
- Try an exercise like first glance to get past the overwhelming experience of new code
Marit encouraged developers to join a code reading club and discover how to better understand the code they have to work with.
Marit had many other tips and examples for developers. For those, you will have to watch her full presentation on the Duke Turns 30 section of our website.
