CSC/ECE 517 Fall 2009/wiki3 teamhelm: Difference between revisions
(25 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
== '''The Release Reuse Equivalency Principle (REP)''' == | == '''The Release Reuse Equivalency Principle (REP)''' == | ||
Components can be effectively reused only if they are released through a tracking system. | |||
__TOC__ | __TOC__ | ||
Line 5: | Line 6: | ||
=='''''Concept'''''== | =='''''Concept'''''== | ||
The Release Reuse Equivalency Principle (REP), first introduced by Bob Martin, is described as follows: | The Release Reuse Equivalency Principle (REP), first introduced by [http://en.wikipedia.org/wiki/Robert_Cecil_Martin Bob Martin], is described as follows: | ||
Line 11: | Line 12: | ||
"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. | ||
Line 25: | Line 26: | ||
=='''''Description'''''== | =='''''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 | 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 [http://en.wikipedia.org/wiki/Version_control version control]. Some common examples of version control are [http://en.wikipedia.org/wiki/Subversion_%28software%29 SVN], [http://en.wikipedia.org/wiki/Concurrent_Versions_System CVS] and [http://en.wikipedia.org/wiki/Cmvc 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. | 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. | 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 [http://en.wikipedia.org/wiki/Source_code source code] (other than the public portions of header files). I need only link with static | |||
[http://en.wikipedia.org/wiki/Library_%28computing%29 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 [http://en.wikipedia.org/wiki/Object_oriented_design Object-Oriented design] and therefore cannot be properly maintained without release. | |||
=='''''Advantages'''''== | =='''''Advantages'''''== | ||
The obvious advantages of REP are: | |||
1. [http://en.wikipedia.org/wiki/Software_maintenance Maintainability]. There is no need to maintain reused code. This is done by the owner of the reused (released) code.<br> | |||
2. Flexibility. The consumer of the reused code can decide what version and on what timetable the reused code is adopted.<br> | |||
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'''''== | =='''''Disadvantages'''''== | ||
As REP is a [http://en.wikipedia.org/wiki/Cohesion_%28computer_science%29 Cohesion] Principle, the disadvantages would be similar to disadvantages of cohesion principles. | |||
1. REP is not simple for the maintainer of the code. The code owner must maintain several [http://en.wikipedia.org/wiki/Software_versioning versions] of the code, as well as large [http://en.wikipedia.org/wiki/Software_package_%28installation%29 packages].<br> | |||
2. The package structure cannot be designed from the top down, meaning that it would not be one of the first things about a system that is designed. Because of this, the package structure remains in a constant state of flux. [3]<br> | |||
3. The best [http://en.wikipedia.org/wiki/Software_design design] philosophy cannot depend solely on REP. REP is best suited for a system that has gone through the initial planning, design and development stages to ensure that the package structure can be utilized effectively. | |||
=='''''Example'''''== | =='''''Example'''''== | ||
The Java Boutique describes a [http://javaboutique.internet.com/Case_Study/ tutorial] for designing a system with, among other principles, REP. | |||
A "bad" example of not following REP is to reuse code by copying the source code. Just a few days after Microsoft released its Windows 7 operating system, it had to apologize to the public for violating the [http://en.wikipedia.org/wiki/Gpl GPL] license.[5] A utility tool it hired the third party to develop contains a chunk of open source code with a [http://en.wikipedia.org/wiki/Gpl GPL] license attached to it. Microsoft had to open its own source code for this utility program. | |||
=='''''Conclusion'''''== | =='''''Conclusion'''''== | ||
Code should be reused by including the released [http://en.wikipedia.org/wiki/Software_library library], not by copying the code. This ensures the reused code is maintained by a single authority to avoid the divergence of the reused code. In fact, the user should never see the source code for reuse except the included header files - <b>The unit of reuse is the unit of release</b>. | |||
The users of the library need to know the version/signature for dependency control and for reliable reversal to the originals after failed upgrade. The author need the same information to maintain and support the released product - <b>Effective reuse requires a change control system</b>. | |||
Though a class is the <i>de facto</i> unit of reuse, its reuse is mostly confined to the author of related classes and collectively make them a large functional unit or package. The REP is targeting a wide audience who are more interested in reuse of a large functional unit or a class in that context. Keeping track of versions of individual classes would be, more often than not, burdensome to users who both use multiple classes within the same package and authors who need to maintain individual classes and their inter-dependencies within the large functional unit. <b>The effective unit of reuse and release is the package</B>. | |||
REP not only applies to external users, but also applies within the organization among different development groups. | |||
'''''References''''' | =='''''References'''''== | ||
[1] Design Principles and Patterns: http://www.objectmentor.com/resources/articles/Principles_and_Patterns.pdf <br> | [1] Design Principles and Patterns: http://www.objectmentor.com/resources/articles/Principles_and_Patterns.pdf <br> | ||
[2] Reuse Release Equivalence Principle: http://c2.com/cgi/wiki$?ReuseReleaseEquivalencePrinciple<br> | |||
[3] Granularity: http://www.objectmentor.com/resources/articles/granularity.pdf<br> | |||
[4] Object Oriented Software Construction, Bertrand Meyer, Prentice Hall, 1988 | |||
[5] Microsoft will open source Windows 7 tool that includes GPL code: http://www.infoworld.com/d/windows/microsoft-will-open-source-windows-7-tool-includes-gpl-code-442 |
Latest revision as of 14:14, 19 November 2009
The Release Reuse Equivalency Principle (REP)
Components can be effectively reused only if they are released through a tracking system.
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 reused (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
As REP is a Cohesion Principle, the disadvantages would be similar to disadvantages of cohesion principles.
1. REP is not simple for the maintainer of the code. The code owner must maintain several versions of the code, as well as large packages.
2. The package structure cannot be designed from the top down, meaning that it would not be one of the first things about a system that is designed. Because of this, the package structure remains in a constant state of flux. [3]
3. The best design philosophy cannot depend solely on REP. REP is best suited for a system that has gone through the initial planning, design and development stages to ensure that the package structure can be utilized effectively.
Example
The Java Boutique describes a tutorial for designing a system with, among other principles, REP.
A "bad" example of not following REP is to reuse code by copying the source code. Just a few days after Microsoft released its Windows 7 operating system, it had to apologize to the public for violating the GPL license.[5] A utility tool it hired the third party to develop contains a chunk of open source code with a GPL license attached to it. Microsoft had to open its own source code for this utility program.
Conclusion
Code should be reused by including the released library, not by copying the code. This ensures the reused code is maintained by a single authority to avoid the divergence of the reused code. In fact, the user should never see the source code for reuse except the included header files - The unit of reuse is the unit of release.
The users of the library need to know the version/signature for dependency control and for reliable reversal to the originals after failed upgrade. The author need the same information to maintain and support the released product - Effective reuse requires a change control system.
Though a class is the de facto unit of reuse, its reuse is mostly confined to the author of related classes and collectively make them a large functional unit or package. The REP is targeting a wide audience who are more interested in reuse of a large functional unit or a class in that context. Keeping track of versions of individual classes would be, more often than not, burdensome to users who both use multiple classes within the same package and authors who need to maintain individual classes and their inter-dependencies within the large functional unit. The effective unit of reuse and release is the package.
REP not only applies to external users, but also applies within the organization among different development groups.
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
[4] Object Oriented Software Construction, Bertrand Meyer, Prentice Hall, 1988
[5] Microsoft will open source Windows 7 tool that includes GPL code: http://www.infoworld.com/d/windows/microsoft-will-open-source-windows-7-tool-includes-gpl-code-442