Top tips to finding your way around a new codebase
Almost a year ago, I joined Lantum: a company with a mission to save the NHS £1 billion in staffing agency fees.
The team at Lantum are great, and everyone is so welcoming to new joiners, which helped me enormously to feel comfortable in my new role as a Senior Frontend Engineer.
However, starting any new dev position comes with the challenge of a new codebase that you may never have seen before.
And while every developer wants to get stuck into coding as soon as possible, starting on a new codebase can be scary, and imposter syndrome is a real thing - especially when you’re starting a new role as well.
But with these top tips, you can get comfortable - and get started coding - much quicker.
- Write tests
- Read and write documentation
- Use grep
- Use editor extensions
- Use the product
- Code review
- Ask questions
Write a test as your first contribution
Writing a test requires you to understand how the code works, and what it is meant to be doing. It’s a great way to get up to speed quickly.
Since tests usually have a clear description of what the code should be doing, they will help you understand the wider context of your work.
Try writing tests for some untested code for your first contributions. Not only do you not have to worry about breaking production code, it’s a quick way to get started coding as soon as possible.
Read and write documentation
Many codebases will have some kind of instructions on setup and usage, normally in the form of a README. If you’re looking for something other than a test to be your first contribution, editing the README or other documentation is a great place to start.
There are almost always small things which have changed or things that can be improved in the setup, so update the docs and make it better for the next developer.
And make sure you refer to the documentation before you start coding too, so you have the background knowledge you need when you look at the code.
Make grep your best friend
Grep, or in other words, “Find all”, is a quick and easy way to find where you need to be in the code. Search for keywords, variable or function names and you will almost instantly find where you need to be.
Look up in your editor what the grep command is, and soon it will become one of your most used commands. You’ll begin to know the codebase inside out.
Use editor extensions to cater for your coding needs
There are a ton of editor extensions out there, many that will make your life a lot easier when starting on a new codebase. My top three are:
- Linters - e.g. ESLint, stylelint. A linter will help you write good code and highlight any errors instantly.
- Code formatters - e.g. Prettier, Beautify. These mean you don’t have to worry about code formatting and you can concentrate on learning more important things.
- GitLens. This is a VS Code extension which will help you to visualise code authorship and quickly see who, why and when a line or code block was changed.
Use the product
As engineers, we aren’t in contact with customers on a regular basis. This can make us forget the reason why we’re building what we’re building, so try and use the platform itself from the very beginning.
Start by getting to grips with what the platform does: its features, the interactions, and so on. Stay close to the problem that the product is trying to solve. Not only does it help give you context while coding, but it also makes you a better, more well-rounded engineer.
Code review, code review, code review
Code reviewing is a great skill and you get better with practice. It’s undoubtedly hard to code review on a codebase that you are unfamiliar with, as you won’t know the context of the feature or how it affects the codebase. However, code reviews show you in a practical way how the codebase works and how it is structured. Take it slow; practice makes perfect.
Don’t be afraid to ask questions and pair program
If there is an existing codebase, then there is likely an existing team who have worked on the codebase. Your team members will be your ultimate source of knowledge, so don’t be shy about asking questions - it will get you up to speed much faster.
Pair programming is a great way to make the most of your teammate’s knowledge. Book half an hour into their calendar - you’ll be surprised how much you will learn in such a short space of time.
Ruth Uwemedimo is a Senior Software Engineer at Lantum.