Code Reviews – Should Top Programmers Check Everyone’s Code?

code-reviewsproductivityversion control

One of the differences between svn and git is the ability to control access to the repository. It's hard to compare the two because there is a difference of perspective about who should be allowed to commit changes at all!

This question is about using git as a centralized repository for a team at a company somewhere. Assume that the members of the team are of varying skill levels, much the way they are at most companies.

Git seems to assume that your only your best (most productive, most experienced) programmers are trusted to check in code. If that's the case, you are taking their time away from actually writing code to review other people's code in order to check it in. Does this pay off? I really want to focus this question on what is the best use of your best programmer's time, not on best version-control practices in general. A corollary might be, do good programmers quit if a significant portion of their job is to review other people's code? I think both questions boil down to: is the review worth the productivity hit?

Best Answer

Since it's not clear from your question, I just want to point out that a gatekeeper workflow is by no means required with git. It's popular with open source projects because of the large number of untrusted contributors, but doesn't make as much sense within an organization. You have the option to give everyone push access if you want.

What people are neglecting in this analysis is that good programmers spend a lot of time dealing with other programmers' broken code anyway. If everyone has push access, then the build will get broken, and the best programmers tend to be the ones frequently integrating and tracking down the culprits when things break.

The thing about everyone having push access is that when something breaks, everyone who pulls gets a broken build until the offending commit is reverted or fixed. With a gatekeeper workflow, only the gatekeeper is affected. In other words, you are affecting only one of your best programmers instead of all of them.

It might turn out that your code quality is fairly high and the cost-benefit ratio of a gatekeeper is still not worth it, but don't neglect the familiar costs. Just because you are accustomed to that productivity loss doesn't mean it isn't incurred.

Also, don't forget to explore hybrid options. It's very easy with git to set up a repository that anyone can push to, then have a gatekeeper like a senior developer, tester, or even an automated continuous integration server decide if and when a change makes it into a second, more stable repository. That way you can get the best of both worlds.

Related Topic