Incremental and Iterative

When using Agile approaches, few take the word Incremental as far as the Extreme Programming community in not letting the sun set on bad code. WHat that meant was that any code changes made during the day had to be either tested and committed back to the source code repository or abandoned as an experiment that enabled learning about the design. Abandoned meaning that the changes were deleted by just checking out the contents of the current repository — and typically the next day a better solution was implemented in less time than the original experiment took.

Now that most teams are using PRs (aka Pull Requests), the same thing applies. Make the smallest possible change that makes sense and push that as a tested PR to be merged to the repository. A tiny, coherent and understandable change is quick to review, approve and merge (assuming that the team has good unit tests).

What is a good size for a PR?

My take is that a few hours work is the upper limit.

That will seem absurdly small for teams used to working in a separate branch for weeks on end, but those teams get to experience the joys of what used to be called Integration Hell and now is often called a Merge Conflict. The contents of the code repository have diverged so far from the separate branch that the code no longer fits. It needs reworking to match the new shape of the code.

Iterative Development

This is a fancy word to mean rework. A more modern word is Refactoring, the practice of reworking the code when a better understanding of the requirements and design emerges so that the code needs to be changed to better reflect the team’s understanding of the problem.

The point of iterating on the design is to take the initial clunky kludge and rework it to make it easier to extend and build on. The rework may be as simple as renaming methods or a more complicated realignment of responsibilities, but the purpose is to make the code easier to work on in the future — even if that future is later the same day.

Delaying the cleanup is always a mistake, just talk to any company that is dealing with Legacy code.