r/AskProgramming • • Oct 10 '26

Architecture How do you approach understanding and modifying a large open-source codebase?

Hey guys, I often find interesting projects on GitHub. Getting them running is usually fine, but when I want to understand how something works or make my own changes, I get completely lost in the codebase.

Mature projects have so many abstractions, design patterns, error handling, and logic spread across different files that I never know where to start or how deep to go.

I once spent a whole week using AI to walk me through a project starting from main(). I kept diving into details, and by the end, I barely remembered anything.

Someone also suggested drawing flowcharts to understand the code, but the more I drew, the bigger and messier they became.

How do experienced developers approach unfamiliar codebases when they actually want to understand and modify them?

How do you decide what to read, what to skip, and when you understand enough to start making changes? And has AI genuinely helped you with this?

Any advice or personal experiences would be greatly appreciated. Thanks in advance!

11 Upvotes

8 comments sorted by

4

u/MWhizzy Oct 11 '26

We submitted a pull request for a major project. There was a compatibility bug with a new Apple chip. We recognized the bug. We determined why the bug happened. We fixed it.

We didn’t care to know the whole codebase front to back. We just needed to understand the part we were changing.

So the answer to your question isn’t always the same.

3

u/Translatabot Oct 10 '26

You don’t need to be familiar with the codebase. In fact, in large projects, nobody is familiar with all parts of the code.

You should always start with a problem you want to solve and then slowly gather all the context you need to be able to solve it. The first time is obviously the hardest, but you’ll expand your knowledge with every new problem you solve.

Always start with the simplest non-trivial problem.

1

u/QPGMR_de Oct 10 '26

My way is, to ask Bob to write me a broad overview of the application "modules" with a structural graph (Mermaid) and tables in MarkDown.

From there I keep diving deeper - always with output to MarkDown - incl. Mermaid graphs and so on.

This way you can always feed those MDs to your Agent again later as context.

1

u/CappuccinoCodes Oct 10 '26

"I once spent a whole week using AI to walk me through a project starting from main(). I kept diving into details, and by the end, I barely remembered anything."

That's a good approach. But you'll only be familiar with the codebase if you spend a long time with it across a period of time. There are no shortcuts for that.

"Someone also suggested drawing flowcharts to understand the code, but the more I drew, the bigger and messier they became."

Drawing diagramas it's super important, at least for my learning style. It's ok to have big detail flowcharts but you can also have higher level ones that summarize the systems.

1

u/CS_70 Oct 10 '26

Nobody knows a big enough codebase.

You just need to know enough to know where to start looking. That means the broad architecture, a sufficient idea of the dynamic flows and the basic abstractions around which both have been built.

When you want to attack a problem or add a feature, you go in detail in that part only.

If you do it often, after a while you will naturally know a lot of details of lots of parts (until they change, or you forget).

In other words, want you want to build in your head is layers of abstraction - which is often how a system was made up in the first place.

1

u/The_Aspalar Oct 11 '26

It is hard to fully grasp a huge codebase. You will eventually have a vague mental image of how everything connects together the more areas you touch, but things will change, and you will forget things. Even I don’t fully grasp one of my personal big projects now 😂, and I wrote the whole thing.