# Understanding Code Reviews: Junior vs. Senior Engineers
Written on
Chapter 1: The Importance of Code Reviews
Code reviews are an integral part of every engineer's routine. Having another person review your code before it is deployed is essential. However, many engineers tend to quickly skim through the code and approve it without much thought. In contrast, a smaller group will provide valuable feedback, identifying bugs and issues that you might have overlooked. This article will highlight key considerations for conducting effective code reviews, drawing from my experiences at various companies in London, as well as insights from the book "Software Engineering at Google."
While the advantages of code reviews are well-known among engineers, it’s crucial to understand what to focus on during the review process and how to conduct it effectively. Additionally, the order in which you approach these steps can significantly impact the quality of your review.
Section 1.1: Assessing Code Correctness
Determining the correctness of the code may seem straightforward, but it often requires a deep understanding of the business context. Before diving into the code, review the original ticket associated with the pull request to ensure you comprehend its intent. If the code introduces a new feature, manually test it in the development or staging environment prior to the review. Ultimately, the code must address the business need; if it fails to do so, further review may be unnecessary.
Key factors to enhance code correctness include:
- Inclusion of tests
- Adherence to system design (if applicable)
- Overall code efficiency (considering its big O complexity)
Section 1.2: Ensuring Code Comprehension
Once you’re confident in the correctness of the code, the next step is to assess its comprehensibility. Code serves as a means of communication among engineers, and if it’s not easily understandable, it loses its value. While it can be tedious to adjust code for minor semantic changes, prioritizing clarity is essential for collaborative development.
Subsection 1.2.1: Code Consistency
Maintaining consistency across the codebase is vital. As a junior engineer, I often received feedback regarding code consistency due to my limited familiarity with the codebase and language. Before submitting a pull request, familiarize yourself with existing code patterns and standards to ensure alignment with the overall project.
Remember, even if your code is correct and understandable, it may not be accepted if it deviates from established patterns. This is particularly important in larger organizations where codebases can be extensive and complex. Always look for existing patterns before implementing new code to save time and effort.
Chapter 2: The Knowledge-Sharing Aspect of Code Reviews
During code reviews, it’s essential to recognize the opportunity for knowledge sharing. Your role goes beyond merely approving another engineer's code; you should also seek to learn from them. Asking questions on pull requests can enhance your understanding, leading to more insightful feedback.
Additionally, it’s advisable to keep pull requests small and provide detailed descriptions. Clearly explain the rationale for changes and the design patterns utilized.
Lastly, leverage automation tools to streamline the review process. Minimize the time spent on trivial issues like whitespace adjustments, typos, and indentation—let technology handle those.
This video titled "The Code Review: Junior Engineer vs Senior Engineer (parody)" humorously illustrates the differences in code review approaches between junior and senior engineers.
In this video, "The Difference Between A Junior, Mid and Senior Engineer - How You Can Grow Into Each Of These Roles," the distinctions between the various engineering roles are explained, highlighting pathways for career growth.