Featured Whitepapers
- Forrester Research: Optimizing Globally Distributed Software Development Using Subversion
- An Integrated Approach to Requirements and Quality Management
- Continuous Testing With ElectricCommander
- Agile CMMI at a Large Investment Bank
- Realize Effective Distributed Development Via a Virtual Software Factory
- Build & Deployment Automation for the Lean Economy
Upcoming & Recent Webcasts
- A New Kind of Engineering
- Managing Change in Rugged COTS Systems Development
- Keeping Control of Costs and Schedules When Requirements Change
- Three Simple Things that Will Help You Adopt Agile in Your Enterprise
- Customer speak: Teams, Insights, Results with Quality Driven Software
- Build & Deployment Automation for the Lean Economy
Principles of Agile Version Control: From OOD to TBD |
| Print | |
| Written by Brad Appleton, Steve Berczuk and Robert Cowham | ||||||||||||||||||||||||||||||||||||||||||||||||
| Monday, 19 June 2006 03:30 | ||||||||||||||||||||||||||||||||||||||||||||||||
|
We are going to discuss some of the principles of version control that help enable agile development. With an understanding of the principles of object-oriented design, as well as the principles of agile development, lean production, the theory of constraints (including critical chain), and a little bit of six sigma, we can derive some of these principles of agile version control. In this article, we will limit our focus to the principles of object-oriented design (OOD) and how we can use them to derive corresponding version control principles for task-based development (TBD). Symptoms of Poor Version Control If agile and iterative development are always integrating, building and testing the software in very small increments, then how can we ever have stable baselines or codelines? How can we ever propagate fixes or enhancements from legacy releases to the current under-development release and make sure we aren't doing too much branching, merging and baselining? How can we make sure that the branching, merging and baselining that we are doing follows a simple, yet structured fashion that safeguards the integrity and reproducibility of the software without hindering productivity and development creativity? Robert Martin desribes several symptoms of poor design in [1] that translate quite readily into symptoms of poor version control:
Why do these things happen? They may happen due to laziness or ignorance, or short-sightedness, or a host of other reasons. They happen because the practitioners involved haven't yet learned or appreciated the importance of sound version control principles and practices and haven't suffered the consequences of not following them. Or perhaps they have suffered the consequences but they don't understand why. So they blame it on the wrong thing and avoid doing the right things, such as trying to prevent change when they need to simply make change easier to do, or try to overcompensate for something “bad” that happened by going too far to the other extreme. What's a seasoned veteran version-control practitioner to do? They do what they've always done! They use sound practices and judgment honed from years of experience to recognize these symptoms and their underlying problems, identify which principles have been violated, and apply the appropriate SCM patterns [2] for their particular context. What are these practices and principles that help us to recognize and resolve these problems? Many of the practices come from what is commonly called change-based (or change-oriented) versioning and task-based development. The corresponding principles have much in common with the principles of object-oriented design. Principles of Object-Oriented Design The principles of object-oriented design [1] address the need to minimize the complexity and impact of change by minimizing dependencies through the use of loosely coupled and highly cohesive classes, interfaces, and packages. Classes, interfaces and packages are the logical containers of software functionality. These logical entitities are realized in “physical” containers of version control (configuration elements) in the form of files, libraries and components, and are as follows:
We wish to derive similar principles for version control using the logical containers of change-based versioning and task-based development:
The resulting version control principles should address the need to minimize the complexity and impact of change by minimizing dependencies through the use of loosely coupled and highly cohesive, correct and consistent changes, versions and codelines. We must be very mindful of the notion of time when deriving these principles in order to properly and accurately translate their meaning from the domain of classes and packages to the domain of version control. In addition to terms like “classes” and “packages”, we will also need to translate the meaning of terms like “abstract,” “interface” and “stability” into the domain of version control:
With the above terminology translations in effect, we are now prepared to attempt translating the principles of OOD into version control principles, and to explore their validity and applicability. The Principles of Task-Based Development (TBD) To derive these principles, we need to identify the "objects" that correspond to the version-control abstractions whose dependencies we wish to minimize and manage. Each version-control object is named container that "encapsulates" its associated state (data/contents). The key "behavior" a container exhibits is that of evolution: either the container's contents are allowed to change, while still being the same container, or else the container (but not it's contents) undergoes a change of state as it evolves. Any time a container "evolves" there is some set of characteristics (its "interface") that it tries to preserve within its own "context." The part that is unchanged by the "evolution" operation is an important part of the "context" for the object.
The principles of OOD refer almost exclusively to classes or packages, but we will need to determine how they apply to all of the above. Some OOD principles may apply to more than one of these version-control objects (possibly resulting in multiple principles). We must keep this in mind as we derive our principles of version-control. A first pass through the principles would seem to suggest the following ... Single Responsibility ~ Cohesive Flow The Single Responsibility Principle for OOD says that “a class should have one and only one reason to change.” This is a statement of cohesion for a class, that it should encapsulate a single coherent and cohesive responsibility. Restating this in terms of version-control would yield: A container should have one, and only one, reason for its state to change. This is a statement about Cohesive Flow of evolution. Every evolutionary step should happen for a distinct reason, and all the things that changed should have been very closely-related. This an extremely generic statement and would probably be a lot easier to understand if we broke it down by the various kinds of containers to which it may apply. We'll do that later, for now, let's press onward. Open-Closed ~ Identity Preservation The Open-Closed Principle for OOD says that a class should be “open for extension, but closed for modification.” Translating this into version-control terms is a little bit tricky. "Extension" corresponds to deriving or evolving a new entity from an existing entity. If we add to the existing entity we create a new one that reuses the essential characteristics of the original. But I shouldnt have to modify the original entity in order to do it? What does that mean? The original entity or container corresponded to a particular meaning at a certain point in time. Evolving it into a new "thing" shouldnt destroy the existence or history of what it evolved from. The evolved result may be "new", but this is version control, and the "thing" that evolved must somehow maintain its "identity" or "essence." This is a statement about Identity Preservation: A container should be open for evolution, but closed against redefinition. What does this mean? We'll, say more about that later too. Onward again! Liskov Substitution ~ Evolution Integrity The Liskov-Substitution Principle for OOD says that “derived classes should be substitutable for their base classes.” In this context, “substitutable” means “requires no stronger pre-conditions, and ensures no weaker post-conditions.” In version-control terms this means that: Derived containers must be substitutable for (require no more, and ensure no less than) their base containers. This is a statement of Evolution Integrity, but we need to determine what a "derived container" is. Within the flow of a codeline, the current configuration is "derived from" it's predecessor configuration, as suggested by Anne Mette Hass in [9]. A derived container might also mean a branch, which "inherits" it's initial content from its branchpoint. Dependency Inversion ~ Container-based Dependency The Dependency Inversion Principle for OOD says to “depend upon abstractions, not concretions” or equivalently “abstractions should not depend upon details; details should depend upon abstractions.” This is a statement about separating policy from mechanism to depend in the direction of increasing abstraction (or decreasing detail). In the case of "abstraction", a version control "abstraction" might be a baseline or a codeline, which abstracts and encapsulates a single or “current” configuration from the details of its content. A “detail” would be a detail about the composition (content) of the configuration, or of a particular change. So DIP would mean we should depend upon a specific codeline or labeled configuration, and not upon their specific contents or context. This gives us: Depend upon named containers, not upon their specific contents or context. This is the version control equivalent of saying "program to an interface, not to an implementation." It is closely related to the Principle of Least Assumed Knowledge or "Law of Demeter." Least Assumed Knowledge ~ Evolution Insulation The Law of Demeter is not one of the principles from [1]. It is actually a separate "principle" that is really more of a style rule for "structure shyness" in object-oriented programming. In its more general form, it simply says that objects should assume as little knowledge as possible about the structure and data/attributes of other objects (including of its own subparts). This would translate into something like: A version-control container should assume as little knowledge as possible about the content of other containers (including its own subparts). DRY ~ Container Encapsulation The DRY Principle would seem to translate pretty directly to version control terminology:Each pieve of version-control information should have a single unambiguous authoritative representation within the version-control system. Interface Segregation ~ Promotion Leveling & Codeline Branching The Interface Segregration Principle for OOD says “make fine-grained interfaces that are client-specific.” All the consumers of a class should be partitioned into one or more “client types” and a separate abstract interface should be defined for each type of client the class must serve. Interfaces are a form of abstraction/abstractness, and for version control we beleive that translates into acceptance criteria (for the "users" of a container) and level of visibility of a container. For version control, "interface segregation" can be applied to changes, baselines, and codelines:
All of these are really just forms of Visible Incremental Evolution when restating the general form of ISP in terms of version-control containers: Make fine grained acceptance-criteria that are client-specific. Reuse, Release and Evolution Granularity The OOD principles of Reuse-Release Equivalence, Common Closure, and Common Reuse are all about the appropriate granularity of "packages" of classes. We wish to investigate the corresponding granularity of "packages" of evolution within a version control environment. We can consider the "scope" and granularity of a change, a baseline, a codeline, and beyond. In either case, both (re)use and release imply reuse by some consumer, and releasing to some target consumer. Once again the notion of "abstractness" in OOD translating to the level of visibility of versioned content will play a key role. In version control, reuse of changes and versions occurs when we view or update (merge/modify) a version of one or more files in our workspace in order to develop, build, test and release our changes. The releasing of changes and versions occurs when we commit changes to a codeline, transfer changes between codelines, baseline a configuration, or promote a configuration to a new promotion-level. based on this we already know a few things about change granularity:
Not all of the above require "principles" (the last one in particular seems tautological). Furthermore its not apparent that each of these three OOD principles will translate into individual version control principles. So we instead seek to see if we can apply these three principles together as a group for each of changes, baselines, and codelines. Package Coupling ~ Change-Flow The package coupling principles of OOD translate almost directly to version-control with only slight modification (sometimes "dependency" translates into "flow", but note that change-flow does not imply dependency). They deal with branching and merging and the flow and structure of changes across codelines. What's Next? Now that we've finally set the stage and introduced the players, we'll be exiting the stage until next month, when we finally try and directly apply our translations to each of the different types of version control containers: changes/workspaces, baselines, and codelines. We're very interested in your feedback on these ideas and our initial "mapping" of them into the version-control domain. So if you think we've missed something or you have some insights to share, please let us know. References [1] Agile Software Development: Principles, Patterns, and Practices; by Robert C. Martin; Prentice-Hall, 2002. (See related essays online) [2] Software Configuration Management Patterns: Effective Teamwork, Practical Integration; by Stephen Berczuk and Brad Appleton; Addison-Wesley, November 2002. [3] Object-Oriented Programming: An Objective Sense of Style; by Karl J. Lieberherr, Ian Holland, Arthur Riel; Proceedings of the 1988 Conference on Object-Oriented Programming Systems, Languages, and Applications (OPSLA'88); September 1988, San Diego, CA, pp. 323-334. [4] The Pragmatic Programmer: From Journeyman to Master; by Andrew Hunt and David Thomas; Addison-Wesley, 1999. [5] A Software Configuration Management Model for Supporting Component-Based Software Development; by Hong Mei, Lu Zhang, Fuqing Yang; ACM SIGSOFT Software Engineering Notes, Vol. 26, Issue 2; (March 2001), pp. 53-58; ISSN:0163-5948 [6] A Component-Based Software Configuration Management Model And Its Supporting System; by Hong Mei, Lu Zhang, Fuqing Yang; Journal of Computer Science and Technology, Vol. 17, Issue 4; (July 2002), pp.432 – 441; ISSN:1000-9000 [7] Container-Based SCM and Inter-File Branching; by Laura Wingerd; 1st BCS CMSG Conference, April 2003 (also see accompanying presentation) [8] Flexible Configuration Management for a Component-based Software Asset Repository; by Tom Brett; BCS CMSG event: Why Software Asset Management and Configuration Management is essential, March 2004 (also see accompanying presentation) [9] Configuration Management Principles and Practice; by Anne Mette Hass; Addison-Wesley, December 2002. Chapter 1, “What is Configuration Management?” (available online) Brad Appleton is an enterprise SCM/ALM solution architect for a Fortune 100 technology company. Currently he helps projects and teams adopt and apply agile development & SCM practices. Brad also author's the Agile CM Environments blog, and is co-author of Software Configuration Management Patterns: Effective Teamwork, Practical Integration, the "Agile SCM" column in CMCrossroads.com's CM Journal, is a regular contributor to “The Agile Journal”, and is a former section editor for The C++ Report. Since 1987, Brad has extensive experience using, developing, and supporting SCM environments for teams of all shapes and sizes. He holds an M.S. in Software Engineering and a B.S. in Computer Science and Mathematics. You can reach Brad by email at brad@bradapp.net Robert Cowham has been in software development for over 20 years in roles ranging from programming to project management. He continues his involvement in development projects but spends most of his time on SCM Consultancy and Training. He is the Chair of the Configuration Management Specialist Group of the British Computer Society, has a BSc in Computer Science from Edinburgh University and is a Chartered Engineer (CEng MBCS CITP). You can reach him by email at rc@vaccaperna.co.uk
Set as favorite
Bookmark
Email this
Hits: 9855 Trackback(0)Comments (0)
|
||||||||||||||||||||||||||||||||||||||||||||||||
| Last Updated on Friday, 21 July 2006 06:24 | ||||||||||||||||||||||||||||||||||||||||||||||||


