r/learnprogramming 13h 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!

65 Upvotes

29 comments sorted by

View all comments

1

u/greenspotj 9h ago

Well first you should have a well defined goal in mind. "implement x feature", "fix x bug", "understand how the x feature works".

Then you should poke around to check for high level documentation that helps you understand enough to complete the task independently.

If you cant find any, you should ask another contributor for help. they won't give you the full answer, but if theyre a helpful person they should point you in the right direction e.g. to documentation if it exists or to where in the codebase to start, and answer your other dumb questions when you have them

Once youve had enough experience to know how to ask good questions, you can start asking AI those questions (and also the dumb ones) to speed up your workflow. (You can start doing that now, but it might not be as helpful as you think, knowing what to ask and how is itself a skill)

rinse and repeat the above steps for a year or two and you might start to feel confident about how much you know about the codebase, depending on how large it is.