Skip to content

Instantly share code, notes, and snippets.

@hhimanshu
Last active October 24, 2023 02:11
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hhimanshu/714962f4205d7dddc7e5991a86412805 to your computer and use it in GitHub Desktop.
Save hhimanshu/714962f4205d7dddc7e5991a86412805 to your computer and use it in GitHub Desktop.
how to read unfamiliar codebase

Overview

These are in no particular order. I found them by researching what methods other developers use to understand codebases that they have not seen before.

Recommendations

  • If the codebase has tests, read the tests
  • Try to write tests for the part of codebase you are trying to understand. This helps in understanding the behavior and serve as documentation
  • Get overview of project. See the overall picture. How many modules it has? What are the name of the modules? Pick one module and do deep dive into it.
  • Writing documentation for source code. This is a good practice to understand the codebase. I tend to prefer writing tests over documentation since the source code and tests are truth, documentation decays over time, generally.
  • Find public API/function and go into details of how it achieves it's work.
  • Focus on the types of the API and connect the methods based on how types are consumed.
  • Pick a happy path (successful path) of a code flow, ignore the error handling and validation at first. This will help to understand what is the basic workflow.
  • Do pair programming with someone on the team. This may not work however with open-source projects however.
  • Run the project and trace the output.
  • Ask questions. This can be from the developer on the team or user mailing lists or gitter/IRC channels for open-source projects.
  • Learn to use your IDE to help navigate the project. Iteration speed matters to reproduce the steps while learning.

References

Request

If you see that you use a methodology that is not listed here, feel free to contribute and help others.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment