Code Reviews Are Too Late

2024-08-30

Code reviews are too late in the process. They need to be sooner

Sooner is Better

Code reviews are generally done after the dev has completed their work and ready to merge their changes. I think this is far too late and far to hard for non trivial changes, at this stage the design is done and we end up nitpicking at variable names and formatting, or we see a problem and decide it’s too late to fix without time consuming rework.

Code reviews at the end of the process introduce delays in delivering features or fixes. If significant issues are found during the review, it may require the developer to go back and make substantial changes, thereby extending the time to deployment.This makes the business unhappy as there is pressure to deliver.

Developers may have already moved on to other tasks or projects by the time their code is reviewed. This context switching can make it harder for them to quickly address feedback or recall specific decisions made during implementation it also messes with the schedule if rework is required which discourages fixes and forces a choice of accept bad code or delay the sprint.

Late-stage reviews may not be as effective in terms of learning and knowledge sharing. Developers may miss out on opportunities to learn from mistakes or adopt better practices earlier in the development cycle.

The Alternative

Working as a team over lunch or chat early and discussing coding ideas and concepts is a much better use of time. I have a certain way to handle soft delete of lookup data. If I bring this up at code review it’s far too late. If i bring it up a month prior we can agree and come code review time it’s been done is a way we all agree with.

Earlier reviews provide more opportunities for mentoring junior developers and spreading knowledge across the team. Senior developers can offer guidance and share best practices while the code is still fresh in everyone’s minds.

When code reviews happen earlier, it fosters a culture of collaboration and continuous improvement. Team members can discuss design decisions, architectural choices, and potential pitfalls before significant time and effort are invested in implementation.

It’s also a great way to clean the code before development starts. If there are delays from requirement changes and clarification use this to review to clean the code before starting development.

Implementing Early Code Reviews

To integrate early code reviews effectively into your development process, consider the following steps:

  • Set Clear Guidelines: Establish clear criteria for when code should be reviewed (e.g., after initial implementation, before significant refactoring).
  • Automated Checks: Implement automated tools for code style and basic correctness checks to catch easy-to-spot issues before human review.
  • Peer Programming: Encourage pair programming or collaborative coding sessions where team members can review each other’s code in real-time.
  • Continuous Integration: Integrate code review processes into your CI/CD pipeline to ensure that all changes are reviewed before they reach the main branch.

Conclusion

Code reviews are a cornerstone of software development best practices, but their timing significantly impacts their effectiveness. By shifting towards earlier code reviews, teams can detect and address issues sooner, improve collaboration, and foster a culture of continuous learning and improvement. Embracing this shift requires a commitment to process refinement and a shared understanding of the benefits it brings to both code quality and team dynamics.