CSC/ECE 517 Fall 2009/wiki3 teamhelm: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
Line 11: Line 11:




"A reusable element, be it a component, a class, or a cluster of classes, cannot be
Martin elaborates: "A reusable element, be it a component, a class, or a cluster of classes, cannot be
reused unless it is managed by a release system of some kind. Users will be unwilling
reused unless it is managed by a release system of some kind. Users will be unwilling
to use the element if they are forced to upgrade every time the author changes it.
to use the element if they are forced to upgrade every time the author changes it.

Revision as of 16:07, 15 November 2009

The Release Reuse Equivalency Principle (REP)

Concept

The Release Reuse Equivalency Principle (REP), first introduced by Bob Martin, is described as follows:


"The granule of reuse is the granule of release."


Martin elaborates: "A reusable element, be it a component, a class, or a cluster of classes, cannot be reused unless it is managed by a release system of some kind. Users will be unwilling to use the element if they are forced to upgrade every time the author changes it. Thus. even though the author has released a new version of his reusable element, he must be willing to support and maintain older versions while his customers go about the slow business of getting ready to upgrade. Thus, clients will refuse to reuse an element unless the author promises to keep track of version numbers, and maintain old versions for awhile. Therefore, one criterion for grouping classes into packages is reuse. Since packages are the unit of release, they are also the unit of reuse. Therefore architects would do well to group reusable classes together into packages." [1]

Description

Martin describes a "release system" in his concept, which refers to a system that is able to track versions of code as it is changed. This is also sometimes referred to as version control. Some common examples of version control are SVN, CVS and CMVC.


Martin also states that customers are slow to upgrade newer versions of code. This is commonly true for several reasons, including fear of instability of software, internal process, management approvals, and downtime for software systems.


Another critical concept here is that Martin states clients will refuse to upgrade unless the author tracks version numbers. This is related to the previous concept, where a client or customer, because of the above factors, may need to revert the system to a previous version of the code because the new version has caused a problem or outage.


REP has also been described in the following way:

"..in order to effectively reuse code it must arrive in a complete, black-box, package that is to be used but not changed. Users of the code are shielded from changes to it because they can choose when to integrate changes from the package into their own code. While this supports code ownership, and even promotes it, it does not enforce it." [2]

Further elaboration on REP is noted here:

"I reuse code if, and only if, I never need to look at the source code (other than the public portions of header files). I need only link with static libraries or include dynamic libraries. Whenever these libraries are fixed or enhanced, I receive a new version which I can then integrate into my system when opportunity allows. That is, I expect the code I am reusing to be treated like a product. It is not maintained by me. It is not distributed by me. I am the customer, and the author, or some other entity, is responsible for maintaining it. Thus, I can reuse nothing that is not also released. Moreover, when I reuse something in a released library, I am in effect a client of the entire library."[3]

In a nutshell, Martin is stating that reuse (not copying) is useless and meaningless without release. The concept of reuse is vital to elegant Object-Oriented design and therefore cannot be properly maintained without release.

Advantages

The obvious advantages of REP are:

1. Maintainability. There is no need to maintain reused code. This is done by the owner of the resused (released) code.
2. Flexibility. The consumer of the reused code can decide what version and on what timetable the reused code is adopted.
3. Enhancements. There is no need to make the reused code more efficient or to add function. New function can be added by upgrading to a new version of the reused code.

Disadvantages

Example

Conclusion

References

[1] Design Principles and Patterns: http://www.objectmentor.com/resources/articles/Principles_and_Patterns.pdf
[2] Reuse Release Equivalence Principle: http://c2.com/cgi/wiki$?ReuseReleaseEquivalencePrinciple
[3] Granularity: http://www.objectmentor.com/resources/articles/granularity.pdf