Code review is the most important tool for maintaining good and
consistent code across the codebase. If you're the reviewer of
something, it's your job to make sure the code you're reviewing is in
top shape. If you're not the right person to understand all of it, you
should add somebody to the code review who can understand those parts
(it may help to point out the specifics so they don't have to review
the parts you reviewed in detail).
Don't assume the author knows what they're doing. Everybody makes
mistakes: I even found a facepalm-inducing error in Darin's code last
week. Likewise, if the code is too hard for you to understand, it
doesn't mean that you're dumb, it means that it needs to be factored
or commented better. If you can't understand it in code review, how is
somebody coming along in 3 years to fix some bug supposed to have any
hope?
Don't feel shy about holding up reviews that you think still need
improvement. People should have multiple things they can be doing at
once without getting totally blocked on one review. The only time
where a several-day delay should be a problem is with security
patches. If a patch is too large to be reasonably refactored to make
it better, then the patch was probably too large to begin with.
In particular:
- It's not OK to write unit tests "later." This almost never happens.
It also usually means that the author hasn't considered testability in
their design and that it has bugs.
- You should not be working in a mode where you check in code and "fix
it later." This also almost never happens. Sometimes there are
particular changes that are most easily addressed in a separate pass.
But these should be the exception and not the rule, and you shouldn't
do this just to make it more convenient on the patch author.
- To make code easily reviewable and testable, it's usually best to
start with a small core of code with a good test, and expand from
there. Once "something" exists and can be tested, then many people can
be working on different aspects of the code in parallel, all writing
their own tests, while being sure that they haven't broken anything.
Trying to check in a big wad of code is more painful for everybody.
Thanks!
Brett
Don't assume the author knows what they're doing.
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev