Teeps

Getting Started With Code Reviews

21 February 2018 by Westin Schepper

8dfa95c1cd403f042341f79b83f6e2ae3aa1ed1a

It’s time we talked about code reviews. Since code reviews have many perks outside of just development, this blog post is going to discuss them at a general level without getting too specific. We are going to go over what they are, how they work, why you need to implement them with your team, and the impact code reviews have made within our company.

What are code reviews?

A code review is the process of having any code you want merged into the master codebase reviewed by at least one other developer before allowing the merge to occur.

You might be thinking that this process sounds time consuming and doesn't provide much benefit, but let me explain. While it does take time for a developer to review another developer's work, this is a fraction of the overall time spent on a project and the rewards can be exponential.

Breakdown of a code review

This is an outline of how a code review works.

1. A developer (Jack) is tasked with building a new feature.

2. Jack creates a new branch and begins to build.

3. Once Jack has completed the feature, he opens a Pull Request.

4. This notifies the rest of the developers, usually via email.

5. Other developers view the Pull Request, review changes made by Jack and they either:

     a. Approve the changes, which means the code looks great, or

     b. Leave a comment and request that Jack makes an update.

If Jack’s code is approved, he simply merges the code and he is good to go! But if another developer makes a change request, Jack will need to implement the change or discuss possible solutions with that developer.

Developing without code reviews

Right now your team might be implementing features and pushing them to production, which is great, right? You can get features done faster– woohoo! But not so fast, there will be a day when this will come to haunt you. Let me explain:

When your team members are pumping out features left and right without any sort of review, bugs and bad practices can slowly begin to creep into your projects until finally the code looks like a bowl of spaghetti and your project runs about as good as a Ford Focus with diesel fuel.

In more formal words, not implementing code reviews exposes your project to technical debt, a code base that is unstable and conflicting architectural decisions that will cost you time and money in the future to repair.

Why you should add code reviews to your process

So you know what a code review is and you understand the structure of them, but why should you start using them?

  • Issue prevention - The first reason is because they help prevent unexpected functionality before your users or QA team finds them due to poor implementations, which saves time in the long run and prevents a bad user experience. Much like when writing an important email (or even a blog post like this!) that will be seen by several people, it always helps to have a second pair of eyes to catch any issues that may have been overlooked. This is the same concept when doing a code review before pushing code that could potentially impact thousands of users who are using your app.

  • Collaboration and ideation - Code reviews inherently promote collaboration and ideation. This is huge for your code reliability, your developers’ growth, your users’ experience, and ultimately your project’s overall quality. If a feature is poorly implemented, and another developer points this out and begins a conversation, your developers begin to discuss multiple solutions and weigh the pros and cons of them. These interactions are great for knowledge swapping and ensuring the best solutions are being implemented.

  • Developer growth - Having your code reviewed makes your developers have a sense of ownership and accountability in their code. Since they know other developers will be reviewing it, they become more conscious about their implementations. When developers live in silos, the learning opportunities are very infrequent. But in a code review environment, learning is something that happens very often leaving you with stronger developers and a stronger team.

  • Project maintainability- When you have multiple people working on a project, making sure the codebase stays maintainable is very important. If a new developer is brought onto the project, they should be able to recognize programming patterns, file structures, and find things effortlessly. You can help enforce this with code reviews, especially if you have coding standards within your team.

Things to consider

Code reviews can become problematic if you have a “know it all” on your team who is not good at giving or receiving constructive criticism. This could almost be viewed as a benefit, since having a developer on your team who is unwilling to change can help you determine if they are a good fit for your team. Side note– They aren’t.

If you are going to work code reviews into your workflow, you should also define company wide coding standards. We defined our coding standards on a per language basis and store them in a GitHub repo. This is helpful so your codebase is consistent and it gives developers something to reference during code reviews.

It’s important that you approach code reviews with a sense of curiosity and collaboration. The goal is not to judge, criticize or get hung up on minor implementation preferences, but rather to ensure that agreed upon coding standards, quality and efficiency are all being upheld by the team. When this happens, code reviews become a rewarding and enjoyable part of the development process.

Final thoughts

We implemented code reviews as a requirement at TEEPS in 2016 and have had amazing success with it. We have seen a decrease in bugs and poor programming habits, and our developers have grown extremely fast.

This process has stretched out client’s budgets further by preventing technical issues on the front end and spending more time building product features into the apps we are working on. Code reviews and processes like Test Driven Development are just a few of the pillars of our code quality standards here at TEEPS.

If you have additional questions regarding code reviews or coding standards, or just want to say hey, feel free to reach out to us!


Need help bringing your mobile project to life? Our in-house team of designers and developers has built apps for over 70 clients. Get in touch with us.

Let's build your next big thing.

Contact Us