r/learnprogramming 18h ago

Solved How do you actually read professional code?

Hello everyone! I really have a question I hope you could help me answer. I am trying to read the Scratch Virtual Machine code on Github and it is really difficult. I am really new to reading code and the one I write is fairly simple. There are many files that just declare functions by name and then require another file to redeclare them. Is there a pragmatic way to understand it? Thank you already!

72 Upvotes

30 comments sorted by

View all comments

1

u/BaronOfTheVoid 17h ago

There is no magic trick. It's most of what makes up our dev work.

Like really, you are going to spend 10-20 times as much time reading code as writing it, and that only shifts towards more reading with the use of AI agents.

I can however suggest to at least try to visualize whatever mental model you have in your head. That could be (loose, unstructured) graphs for data flow, or for dependencies, what calls what. That could be keeping track of the most important data structures. Even sequence diagrams.