by dcraw · 10y ago · 0 comments
This has a ton of positive effects:
- Reviewing code is much less daunting
- Reviewers give more detailed feedback
- Developers get feedback on lower layers (such as model definition) before writing a ton of code that depends on it
- Reviews come quickly enough that developers don't need to switch to another project before continuing
It was a bit difficult to make this transition. We started out by explaining what we wanted to do (submit shorter diffs) and why, and people generally were on board. But most people didn't know how to do it. It's not as simple as submitting a diff whenever you write 100 lines of code, since the diffs need to be coherent. Here are some techniques we used: - Use feature flags to commit unfinished features to master/trunk without exposing them
- Submit model changes as their own diffs, then API changes, then UI changes
- As you work on a feature, pick out parts that seem ready for review, stage and commit them, send for review, then branch again from that point and continue working. This takes a decent amount of git-fu, so train folks accordingly.
Another thing to note is that our reviews are not at all evenly distributed around the team. We have a team of 13 engineers, and it's probably an 80-20 split—80% of reviews are done by 20% of reviewersI prefer to split domain changes into different commits on the pull request so they can be inspected individually - eg #1 Create API, #2 Consume API with model, #3 View Logic. And for feature flags, try to figure out a possible fully implemented subset of features - eg show new model properties to the user that will in the future be editable.
The only healthy thing to do, is to set a deadline for each. When the deadline comes around, the code should be deleted, or a very valid reason should be brought up to extend the deadline.
There's an article IBM's developerWorks that says code reviews are the most effective when devs are reviewing 2-400 lines of code at a time. However, when you have team members spanned around the globe, it's difficult to get quick feedback, and obviously one shouldn't wait until there's feedback. Some people on my team will also open up a PR really early. What I'm saying is, there are a lot of roadblocks to review the code your team members many time zones apart and still give them the feedback they need on a timely manner. How would you adjust the approach described above to fit team members that are 7-8 timezones aparts?
http://www.ibm.com/developerworks/rational/library/11-proven...
The one code-review-heavy team I worked on did a modified round-robin style. The team wiki had a list of all devs and a count for how many reviews they'd done during the current (3-month) phase. You go in, choose a review with the lowest count, increment their count, then assign them your review. This way, they aren't available again until anyone else who had their count has also done a review.
You could still assign big reviews to senior devs and small reviews to juniors, because there would usually be multiple people with the "lowest" count -- ideally, at some point every dev would have 10 and would then gradually all increment to 11.
There is still a final review when merging the feature branch into the upstream branches, but it's merely a scan and not an in-depth review.
Please manually add newlines to your blockquotes,
otherwise your comments are near-unreadable on
touch-screen devices. And they'll be much better
on mouse-driven ones, too.