We all start our software engineering journey by fixing bugs or developing new features for an existing codebase. Developing features is fun but it is scary to watch someone’s code go wrong. Going through a new codebase is like trying to comprehend the mindset of all the contributors! Moreover, it is not always that you find someone to hold your hand and show you the correct direction. This struggle ends up taking a toll on our mental health and feeling helpless.
It has been a year since I am working as a full-time Software Engineer. As a beginner I had questions like:
How do I begin learning about a certain feature of the product? From where do I start to resolve the bug? How to have better understanding of the codebase? How do I understand the developer’s intents behind certain implementation?
I’d like to share some tips that helped me fix bugs and implement new features.
- Programming language
Having a basic understanding of different language constructs is the first step to accomplish before diving deep into the codebase. Many times you would come across different syntaxes or ways of how code is designed. In such situations, it is always better to pause your search and have a clear understanding of it. Googling the keywords or just copy-pasting the line would bring you to the relevant context. This would help in shedding some light on the motives behind the certain way of implementation.
If you want to build expertise in some language, the best way is to read more of it and implement it. Checking out some good open-source projects would give more exposure to best practices for that language.
2. Knowing your tools better
When fixing a bug or developing a feature, it becomes imperative to understand the existing code flow in terms of how an existing function is being utilized in the codebase. Being a C++, C, and python developer, code navigation tools like cscope and ctags on vim text editor has helped me a lot. Next, being able to use debugger tools like GDB for C and C++ languages and PDB for Python quickened my pace in reaching conclusion. It helps to save a lot of time if you are accustomed to the usage and hacks of these tools. Secondly knowing about how your OS can support you. For instance, if you are working on UNIX-like platforms learning how to use UNIX CLI commands would help.
3. Start from a familiar part of the feature
Starting with what you already know gives you a good point to begin your investigation. Some pointers that help are — checking the intentions of the function, what functions are calling that function, and how that function is calling other functions. In this regard, code navigation tools as discussed in the previous point help. Eventually, it would familiarize you with other parts of the codebase. However, it is very easy to get lost in a large codebase. You cannot eat an elephant in one bite! It brings a lot more sanity in your search if you start with a certain goal or questions defined on what you are aiming to resolve.
4. Checkout those traces
Whenever you see that code compilation error staring back at you, what is your very first instinct to do? I mostly find myself firing up Google with that error hoping to find my answers on StackOverflow! However, that does not help in product-specific error cases that the greater world won’t be familiar with yet. To get some context on the cause of the error it is helpful to add some logs or print statements at places that you are critical to track the cause. The log files or the trace files that get generated during the compilation phase might deduce the answer that we seek.
5. Write! Future you will thank you
I cannot emphasize enough the importance of writing. Human memory is not reliable. Today if you understand something, there are chances that you might forget about it in few months and you’d again have to put in the same effort and time to find your answers. It’s a lifesaver to use that Notes app on your system and write down your understanding or some key pointers about the feature.
6. Get hold of the Design docs
Feature design documents or specifications by the developers indeed gives great detail on problem statement being addressed by the feature, usage of the feature, different alternatives available, different changes done in the product to achieve the solution, possible impacts of the feature on the product, various dependencies, already known issues or caveats and references used to make the feature possible. Mostly these are available in form of READMEs or some textual documents present at the top of the repository. Some larger products have an entire repository dedicated to product specifications. This can give a starter on where to look to start building more on that feature or fixing certain bugs of it. However, remember that at the end of the day code is the best document and single source of truth.
7. Checkout the Tests
Whenever a feature is developed, there are unit tests and automated feature tests performed so as to verify the functionality of the code. Note that it depends on the feature if it would be possible to support automated feature testing. The tests give an idea of expectations of the code performance and expected behavior of the feature in different scenarios. This helps in pushing our research to resolve a bug or add a new feature in the right direction.
8. Checkout issues that are already fixed by the developer
Checking out the bugs raised with respect to the feature and their fixes can give great detail about the feature and the developer’s intents. The idea here is to understand the way that bug was resolved. Nevertheless, it gives you a new point of view towards solving the existing bugs.
9. Look for similar implementation
There can be a possibility of a similar kind of problem that got resolved in some other part of the existing codebase but aiming for another purpose. By searching for appropriate keywords in the codebase, you would be led to similar implementations that you want to implement. Additionally, you can search for how similar problems have been resolved in other open-source projects on Github.
10. Ask for help
Last but not the least, it okay to reach out for help. It’s very much possible that the struggle you are going through has already be faced by your teammates or other members in different forums. Learning about other’s experiences can give you a better understanding of how to hone your own journey.
By no means this list is exhaustive. However, above all is to NEVER GIVE UP! These are some ways that helped me to make meaningful contributions to the projects independently. I’d like to hear about your journey in software development and would love to help in getting started.
I am planning to write more about my experiences so if there is anything in particular if you’d like me to write about, please feel free to contact me @YashikaBadaya.