Code Reviews at Google
I wanted to share a little bit about how Google does code reviews, because both the infrastructure and the philosophy are potentially useful to developers in many companies.
Google tries to do as much as possible through the browser, and that extends to code reviews. We use a web-based code review tool called Mondrian that integrates with the rest of the development infrastructure to provide some unique features.
For example, as you revise files on your local disk over the course of a code review, Mondrian automatically snapshots each revision, without requiring any interaction with the source control system. Mondrian allows reviewers to diff between any two snapshots or the repository version of a file to be sure that all comments have been addressed. Reviewers can leave comments on any line of the file, and authors can respond back to the comments inline. Keyboard shortcuts (similar to those in Gmail) allow reviewers to quickly navigate through the differences and comments.
Mondrian’s features address some of the big issues I’ve encountered with code reviews in the past. Without having to sit down side by side in real time, it’s easy to do a good code review and ensure that all comments have been fully responded to. This makes geographically distributed development easier.
The key ideas behind Mondrian have been released in an open source project called Rietveld, which uses AppEngine and Subversion.
Mondrian was written by Guido van Rossum, author of the Python programming language and a Google employee. Guido has a tech talk that goes into some depth regarding the features of Mondrian.
The right tools enable more efficient engineering and better code quality. By reducing the friction of code reviews, Google can use them liberally. It’s typical to get a code review both from an owner of the package you are modifying and also (if you’re working in a language you’re not so familiar with) with someone who is certified in creating readable code in that language. A code review is a chance to both spot errors and to share expertise and ideas with other engineers.
Update: Curtis Bartley has an interesting post on strengths and weakeness of Mondrian and recommendations relative to Mozilla.
Update 2: One of the commenters asked about source control. Google uses Perforce as the primary source control system but a number of developers (myself included) use Git on their machines. Several Google developers have implemented a good bridge between the P4 and Git worlds as a 20% project.


