These days Pull Requests are the de facto standard for getting code reviewed. Once a developer has finished their change, they will typically submit a Pull Request and move on to their next task. This allows for an asynchronous process to take place which may seem like a good idea, but often is not and can also lead to inefficiencies.
Inefficient code reviews can be caused by:
❌ Figure: Bad example - Vicious cycle of being blocked and picking up yet another task
❌ Figure: Bad example - Inefficiencies caused by asynchronous code reviews
Source: From Async Code Reviews to Co-Creation Patterns
Small Pull Requests have many benefits as outlined above. However, each Pull Request comes with an overhead and making Pull Requests too small can introduce unnecessary waste and negatively affect the throughput of code. In order to not lose throughput with small PRs, reviewers need to react faster. That leads us to synchronous, continuous code reviews and co-creation patterns.
So, with the async way of working, we’re forced to make a trade-off between losing quality (big PRs) and losing throughput (small PRs).
We can avoid this by using co-creation patterns. As a general rule, Pull Requests with less than 20 lines of code, and larger changes with a degree of complexity/risk, make good candidates for co-creation.
The idea is that you do small PR's but also limit WIP. If you create several small PR's quickly and are waiting for code reviews, you can become blocked very quickly. By co-creating, the small PR's get reviewed & merged instantly which avoids getting blocked and enables you to smash out loads of small PRs! 💪Daniel Mackay - SSW Solution Architect
Co-creation patterns can take some different forms:
For the patterns above, the similarities are that there is a driver and a navigator.
Driver - Implements the solution/solves the problem at a granular level. They're the ones on the PC writting the code. Navigator(s) - Observes and understands the what the driver is implementing at a high-level and inquires where needed to help/direct the driver.
Note: It is not the role of the navigator to micromanage the driver.
These roles should swap often to keep a high level of focus and give everyone an equal chance to participate as a driver and navigator.
When using co-creation patterns, ensure you use co-authored commits to give credit to all the developers involved.
Co-creation allows us to have both quality and throughput by providing the following advantages:
Here's a quick guide to getting started. Just note that these are just guidelines and your team, task and experience will dictate exactly how to achieve your goals and increase your code quality
<!-- TODO: Add a PR screenshot of pair programming, show the PR Dan M with Jack R for the big PR for Rules GPT TODO: Add a PR screenshot of mob programming, we need to demonstrate what the PR would look like for this -->