The code review that changed my life
Tags: beginners, career, startup, webdev
Published: 2020-09-01 23:53:00

One code review changed my career as a software engineer. It was around three months into my first job. On that day, I was working on a different part of the codebase that I had never touched before. Up to that point, I had worked almost entirely in JavaScript, but that part of the codebase was written in Python. It isn’t the language I am most comfortable with, but I had some experience using it for school work and my side projects. I implemented what was required, created a new PR, and asked one of the senior engineers to review it. He was a machine learning engineer with many more years of experience than me, and we had never worked on the same part of the codebase together. What he does was way beyond my understanding. I remember I was proud of the fact that I implemented something using a different language. At the same time, I was nervous about getting my code reviewed by him.

After about 30 minutes passed, I went to the bathroom and saw him starting to read my PR. This was good; he would finish the code review by lunchtime. I could merge the PR by early afternoon and could go home feeling good about myself. He didn’t finish the code review by lunchtime. By the time he finished it, it was already past 2 pm. He spent hours reviewing my code. I was somewhat confused and opened the PR. The comments were longer than my code. It made me frustrated and disheartened.

However, as I read the comments I realized that all of what he pointed out made total sense. His comments were thoughtful and never insulting. Some of them were stylistic comments, but what fascinated me were the comments about design principles or code smells. For example, he commented “If you have to pass a boolean as a flag, it is usually a code smell. It means that the function could be two separate functions.” I never paid attention to it until that moment, but it made so much sense. If he didn’t point it out, I would have kept writing the code the same way. All I needed was for him to point it out just once.

But that code review taught me something far more important than specific style tips. My attitude toward writing code had changed from that moment. I became more critical about my code. I started reading some books to learn software design principles. I even started reading reviews of other people’s PRs. After that code review, I began to understand what it means to be a software engineer. I no longer just wanted to ship functional code. I wanted to write code that is readable and maintainable. Software engineering is teamwork.

It’s been more than 6 months since I quit my first job to start a company with my friend. I have been coding as much as before, maybe even more than before. However, I’m noticing the difficulties of growing as an engineer without code reviews from more experienced engineers. Learning a new language is especially challenging. It is hard to know the best practices.

The main purpose of code reviews is to keep the quality of a codebase high, but it is also a great way to share knowledge among a team. Junior developers can learn a lot from code reviews. If you want to get code reviews outside of the work context, a popular way is to participate in open source projects. Open source is a great way to learn from other engineers, but it can be time-consuming and intimidating. Another issue is that some people like to build something on their own rather than participating in open source projects. They don’t have a chance to get their code reviewed.

I’ve seen engineers get rejected at interviews for lacking experience in a production environment. They don’t know how to contribute to a codebase in the context of a company.  These people are stuck in a paradox. How can you expect a recent grad or self-taught developer to understand software engineering fundamentals if they have no prior work experience and the only place you can get the feedback on your code is at work?

I believe code reviews are too valuable to be accessible only to select groups of people. Everyone should be able to benefit from them. Even just one code review can unlock a whole new level of coding ability for someone like it did for me. 

If you’re interested in code reviews, becoming a better developer, and/or helping other people become better developers, check out [Antcode](https://antcode.dev) here. I'm trying to create a community where everyone has access to code reviews.

---

If you liked this post, we recommend you subscribe to the [Antcode blog](https://blog.antcode.dev) and follow us on Twitter at @o_nagen and @mkinoshita12.

If you want to get reviews on your code and learn from reviews on other people's code, we recommend that you check out what we're building at [Antcode](https://antcode.dev) and join our [code review Slack group](https://join.slack.com/t/antcode-workspace/shared_invite/zt-gul4g6de-iPIrB9PiLLab6Rx5wZKZlA).

Happy coding!