Lean Development Principles for Branching and Merging

[article]
Summary:
By reworking lean principles for the branching and merging arena, we're able to create automated builds and unit tests to increase effectiveness and improve quality in software configuration management. Individual developers and teams alike can benefit from this process-improving strategy.

By reworking lean principles for the branching and merging arena, we're able to create automated builds and unit tests to increase effectiveness and improve quality in software configuration management. Individual developers and teams alike can benefit from this process-improving strategy. With lean principles, we can"

  1. Eliminate Waste - Eliminate avoidable merge-propagation (multiple maintenance), duplication (long-lived variant branches), and stale code in infrequently synchronized workspaces (partially completed work). Detect these sorts of situations using some judicious metrics (discussed further below).
  2. Build Quality In - Maintain codeline integrity with (preferably automated) unit & integration tests and a Codeline Policy to establish a set of invariant conditions that all checkins/commits to the codeline must preserve (e.g., running and passing all the tests :-)
  3. Amplify Learning - Facilitate frequent feedback via frequent/continuous integration and workspace update.
  4. Defer Commitment (Decide as late as possible) -- Branch as late as possible! Create a label to take a "snapshot" of where you MIGHT have to branch from, but don't actually create the branch until parallelism is needed. See the example below on "branch on conflict".
  5. Deliver Fast (Deliver as fast as possible) -- complete and commit change-tasks and short-lived branches (such as task-branches, private-branches, and release-prep branches) as early as possible and merge back to the mainline.
  6. Empower the Team (Decide as low as possible) -- let developers reconcile merges and commit their own changes (as opposed to some "dedicated integrator/builder"). Educate and train developers in patterns and their tools such that they are able to select the most appropriate pattern and apply it.
  7. Optimize the "Whole" -- when/if branches are created, use the Mainline pattern to maintain a "leaner" and more manageable branching structure. Use an appropriate balance of methods, some of which conflict.

Much of the above is fairly obvious, and yet there are some implications and advice that we can perhaps tease out.

Metrics for Waste and Whole Process Optimization
Principles such as Eliminate Waste, Deliver Fast and Optimize the Whole all benefit from the use of appropriate metrics to measure and track what is happening and allow feedback on the process ( Amplify Learning ) to be implemented.

Useful metrics (this is usually easier in those tools which track such information centrally) include:

    • Changes done in Task Branches vs Changes in the Mainline - are small tasks done directly in the mainline? How many changes does it take to implement tasks in different branches - is there a pattern?
    • Changes not yet merged from Task Branches to Mainline (WIP). Ensure this doesn't get too high.
    • Age for Changes not yet merged (how stale)
    • Files checked out in Workspaces (by age) - well worth keeping an eye on. Its amazing how many old workspaces can lurk around owned by people who have long since left the company. Is your SCM tool linked in to the HR system to manage company leavers (i.e. included in user permissions to revoke or remove access)?
    • Number of conflicts - either for Task Branches or for Workspace updates - indicates which to use, or perhaps even some repartitioning of the code to reduce conflicts.

Collection of all metrics needs to be automated, and should preferably require no extra work on the part of the developers creating branches or checking in changes.

Some people use automated scripts and yet with a configuration file which indicates perhaps the current set of active branches to be processed (mined for data). Consider if an appropriate repository structure, or branch naming convention can be used which is sufficiently regular to allow scripts to automatically deduce the presence of new branches by their location in

About the author

About the author

About the author

AgileConnection is one of the growing communities of the TechWell network.

Featuring fresh, insightful stories, TechWell.com is the place to go for what is happening in software development and delivery.  Join the conversation now!