Sunday, September 11, 2005

Change-Packaging Principles

In my previous blog-entry I tried translating Uncle Bob's OOD Principles of package cohesion into the version-control domain by substituting "release" with "promote" or "commit", and "reuse" with "test".

I think that didn't work too well. I still think "promotion" corresponds to "release", but "reuse" corresponds to something else. I'm going to try translating "reuse" to "integration". If I integrate (e.g., merge) someone else's changes into my workspace, I am quite literally reusing their work. If I commit my own change to the codeline, then I am submitting my work for reuse by the rest of the team that is using the codeline (particularly the "tip" of the codeline) as the basis of their subsequent changes.

So if I equate "release" with "promotion", and "reuse" with "integration" I think the result is the following:
  • The Promotion-Integration Equivalency Principle -- The granule of integration is the granule of promotion. (So it's not just the change content, but also the context – the entire configuration – that we end up committing to the codeline/workstream.)

  • The Change Closure Principle -- Elements that must be changed together are promoted together (implies task-level commit).

  • The Change Promotion Principle -- Elements that must be integrated together are promoted together (implies doing workspace update prior to task-level commit)
These "work" for me much better than the previous translation attempt. Note that the "change closure principle" didn't change much from before - it was just clarified a bit to indicate the dependency between elements.

This also makes me think I've stumbled onto the proper meaning for translating the Interface Segregation Principle (ISP): ISP states "Make fine-grained interfaces that are client-specific." If "integration" is reuse, then each atom/granule of change is an interface or "container" of the smallest possible unit of reuse.

The smallest possible unit of logical change that I can "commit" that doesn't break the build/codeline would be a very specific, individually testable, piece of behavior. Granted, sometimes it might not be run-time behavior ... it could be build-time behavior, or behavior exhibited at some other binding time.

This would yield the following translation of the ISP into the version-control domain:
    The Change Separation Principle -- Make fine-grained incremental changes that are behavior-specific. (i.e., partition your task into separately verifiable/testable yet minimal increments of behavior.)
I'm not thrilled about the name (please feel free to suggest a better one -- for example ... how about "segmentation" instead of "separation"?) but I think the above translation "works" quite well, and also speaks to "right-sizing" the amount of change that is committed to the codeline as an individual "transaction" of change. The way it's worded seems like it's talking exclusively about "code", but I think it really applies to more than just code, so long as we arent constraining ourselves to execution-time "behavior."

Let me know what you think about these 4 additions to the family of SCM principles!


Anonymous said...

For the names ... should it really be "change promotion principle"? It seems you are describing a set of elements that are "closed under integration"; so might that be the Integration Closure Principle?

And instead of "change separation/segmentation principle" (yuck) ... are you really just saying "frequent integration of small changes"? If so, why not the Incremental Integration Principle? Or if the point is to break-up big tasks into smaller ones, perhaps the Change Partitioning Principle?

Brad Appleton said...

I think maybe you're right. Integration Closure Principle probably is a more accurate name. (And it won't conflict with the upcoming Configuration Promotion Principle, which is analagous to the Liskov Substitution Principle (LSP) and was the next one I was going to cover after BLIMP.)

I also like Incremental Integration Principle better than my current name for it. Tho I wish I could come up with a name that emphasized keeping the increments small, with boundaries delineated by minimal yet testable behavior/functionality.