How to Ensure the Quality of Your Microservices Architecture with Peer Code Reviews
Over the past few years, a growing number of companies have made the move from a monolithic to microservices architecture.
The list of companies that have made the switch include: Netflix, Amazon, Twitter, and PayPal.
A microservices architecture consists of smaller services, each focusing on completing a specific task. Each of these small services, or microservices, can be developed in any language and each can communicate using protocols that are language neutral such as HTTP resource APIs.
A microservices architecture is inherently complex and if not designed and coded correctly, serious problems can occur.
One of the biggest challenges of switching to a microservices architecture is that teams often operate independently from each other.
Each team is responsible for building and deploying one or more microservices to production. Netflix for example, broke down its monolithic architecture into microservices when the number of platform engineers reached about 100. Today, Netflix has about 30+ engineering teams responsible for building and deploying approximately 500+ fine-grained services.
The greater number of engineering teams and microservices, the greater the chances that code errors and other issues will occur.
This is where peer code reviews come in.
One of the best ways to ensure the design and code quality of a microservices architecture is by conducting peer code reviews throughout the development process.
In 2013, Microsoft conducted a study to find out “the motivations, challenges, and outcomes of tool-based code reviews.” The study looked at the many diverse teams at Microsoft and found that while the primary reason for conducting code reviews was finding defects, there were many other benefits to conducting peer code reviews.
- Shared knowledge across teams: Peer code reviews allow developers to share knowledge, discuss alternative solutions, and improve coding skills which in turn helps teams produce clean, well-written code. Architectural problems and security issues can often be caught by conducting code reviews.
- Mentorship: Peer code reviews can be used as a way for team leaders to mentor new members and help familiarize them with the project. New members can learn via peer code reviews different aspects of a project such as architecture design, coding conventions, tools available, APIs to use, and more.
- Shared Ownership: Peer code reviews can help promote the concept “shared code ownership” in which team members work together often having overlapping coding responsibilities. The idea being that the entire team owns the code instead of individual developers owning portions of the code.
Peer code reviews can help enable awareness, transparency, and open communication for every member of every engineering team. This is especially important considering that there can be dozens of autonomous engineering teams involved in the development of a microservices architecture.
One of the keys to implementing peer code reviews is making sure you have the right tools to do it.
Using proper peer code review tools is very important for companies of all sizes, but especially for large companies with many engineering teams and a large number of microservices. Large companies can have difficulty with communication across many engineering teams, effective communication capabilities is an important feature of a code review tool.
There are a number of peer code review solutions available, the best choice depends on the needs of your company.
One of the most popular tools for conducting peer code reviews is GitHub. There are many engineering teams that use GitHub for source control and pull requests for code that is ready for review. GitHub comments can be used by teams to discuss code changes and other issues. Once the review is approved and finalized, the code can be merged.
Collaborator is a code review tool that helps development, testing, and management teams work together to produce high quality code. It allows teams to peer review code, user stories and test plans in a transparent, collaborative framework — instantly keeping the entire team up to speed on changes made to the code.
By enabling team members to work together to review their work, Collaborator can help you catch bugs before your software hits the market.
Collaborator also features GitHub pull request support providing an enhanced peer code review workflow.
Some companies have built and use their own internal tools for conducting peer code reviews. For example, there are many Microsoft developers that use a collaborative code review tool called CodeFlow. CodeFlow is an in-house code review tool developed and used by Microsoft. CodeFlow not only allows developers and managers at Microsoft to conduct code reviews, but also makes it possible to mine data from code reviews as well as generate metrics and analytics from the data.
Peer code review tools help companies streamline the peer code review process and help ensure that useful feedback is produced.
Choosing the best peer code review system and tools for a project based on microservices depends on a variety of factors including the number of engineering teams and microservices involved. If the project involves dozens of autonomous teams building and deploying hundreds of microservices, a highly scalable, efficient peer code review system would be needed.
The lasting benefits of peer code review
A microservices architecture is often built, deployed, and managed by many engineering teams each responsible for one or more specific services.
Peer code reviews can help companies promote open communication, transparency, knowledge sharing, shared code ownership, and many other benefits.
These benefits can help ensure code quality and architectural consistency across many engineering teams and microservices.
Need help implementing code review?
Everyone on your team understands the benefits of using a tool for code review except for one person; your boss. To help with this issue, we’ve recently interviewed over a handful of developers who have given us their best guidelines for how you can successfully approach your boss when it comes time to implementing a code review tool.
They explain what they want you to know and what they want you to do to get your bosses approval for a code review tool.
Click Here to Download the eBook!