Large Codebase
I’ve rearely had to interact with a large codebase, but during my summer internship in Ericsson, I had to do a lot of that.
The outline function in VSCode is super helpful to preview the functions inside a particular file.
Resources:
- https://sparkbox.com/foundry/how_to_understand_a_large_codebase
- https://stackoverflow.com/questions/215076/whats-the-best-way-to-become-familiar-with-a-large-codebase
- https://softwareengineering.stackexchange.com/questions/6395/how-do-you-dive-into-large-code-bases
- https://www.freecodecamp.org/news/how-to-work-with-a-large-legacy-codebase/
- https://medium.com/@zhaojunzhang/work-effectively-on-a-large-codebase-dc0e2242558a
Have a clear goal when you read code and stop reading the code if you reach your goal.
Tip:
- Look at the tests first, to get an intuition. You can use TDD
When developing a new feature:
- Build the simplest possible feature, end to end, and test that
- For example your first URDF task. You first wanna make sure you can create a URDF object using the external libraries, and test that
Points from StackOverflow:
- Step through code in debug mode to see how it works
- Pair up with someone more familiar with the code base than you, taking turns to be the person coding and the person watching/discussing. Rotate partners amongst team members so knowledge gets spread around.
- Write unit tests. Start with an assertion of how you think code will work. If it turns out as you expected, you’ve probably understood the code. If not, you’ve got a puzzle to solve and or an enquiry to make
- Go through existing unit tests for functional code, in a similar fashion to above
- Read UML, Doxygen generated class diagrams and other documentation to get a broad feel of the code
- Make small edits or bug fixes, then gradually build up
- Keep notes, and don’t jump in and start developing; it’s more valuable to spend time understanding than to generate messy or inappropriate code.
this post is a partial duplicate of the-best-way-to-familiarize-yourself-with-an-inherited-codebase_