What's your approach for understanding a big codebase? - eviltoast

understanding a big codebase you have never worked.

  • Kissaki@programming.dev
    link
    fedilink
    English
    arrow-up
    2
    ·
    edit-2
    5 months ago

    Depends on what I want or need to “understand”.

    I’ve worked for many years on a project (it’s a whole project ecosystem tbh with multiple projects; desktop winforms app, server app, SQL server, asp.net MVC app, asp.net blazor app, mobile wpf app, sync service app). On the main project (client + server) I haven’t visited one major area, and another I confidently know that it’s not understandable to me without specific deep effort.

    I recently had to work on the latter. I take a localized approach. Explore what I have to do, without opening the full scoped understanding that’d lead me to architecture refacs. I write out the method call stacks to get an overview of who calls what when. To then know what I have to inspect and analyze further.

    I take notes where necessary, or improve and comment code where appropriate for better understanding and obviousness.

    I create documentation - about concepts and architecture as appropriate and necessary.

    Code should be obvious and intuitive. Concept docs should document the broader concepts.

    When those concept docs exist, those are what you look at to understand app intention and behavior. And it should give you an introduction to architecture. From there, exploring the code should be self-explanatory (but may require specific, repeated, and iterative analysis). And I take notes about what’s relevant and I need for understanding or task.

    Afterwards, those notes should have, or should then integrate into the code base or docs, or be determined irrelevant for that. If I had to write them out and down, it’s more likely they should be part of something than not.