Imagine this: You’re working a critical new feature, one your team anticipates will not only be really popular with your existing users, but which will organically drive growth by attracting a large number of new users. While you’ve been working on this over the last couple of weeks, you’ve noticed a couple dozen minor issues that you fixed as you encountered them. Now your development work is complete, you’ve created a pull request to merge the completed feature into your main branch, ready for release – but almost all of the code changes relate to minor fixes, not the feature itself.

Worse, two of those minor fixes would cause data loss if they got into production, so now you need to carefully reverse those fixes without introducing additional problems.

Distraction Driven Development happens when you include in a lot of unrelated minor changes as you work on a feature, resulting in a branch (or pull request) that addresses many different goals.

Let me be truly clear: the problem here is not that you fixed the minor issues that you saw. You should absolutely fix these issues as you identify them. This kind of ongoing code gardening is an important way to maintain, and even improve, the quality of your code over time.

The problem comes when the fixes become comingled with feature work and each other, making it an all or nothing proposition when it comes to accepting or rejecting the change.

Instead, commit the fixes to separate branches and create multiple pull requests, each specific to changes that affect a single area of your product – a single layer, a single assembly, a single service. This is the single responsibility principle of object-oriented development as applied to change.

Splitting up the fixes also serves to share the load of reviewing. A single large pull request is exponentially more difficult to review than a set of much smaller pull requests, each with a separate intent and purpose. As a side effect, small pull requests are easier and quicker to understand, with reviewers more likely to spot subtle errors and mistakes.


blog comments powered by Disqus
Next Post
Rockstar Driven Development (RDD)  26 Jun 2021
Prior Post
Sharpen The Saw - June 2021  05 Jun 2021
Related Posts
Browsers and WSL  31 Mar 2024
Factory methods and functions  05 Mar 2023
Using Constructors  27 Feb 2023
An Inconvenient API  18 Feb 2023
Method Archetypes  11 Sep 2022
A bash puzzle, solved  02 Jul 2022
A bash puzzle  25 Jun 2022
Improve your troubleshooting by aggregating errors  11 Jun 2022
Improve your troubleshooting by wrapping errors  28 May 2022
Keep your promises  14 May 2022
June 2021