Reuse release equivalence principle
m (Reverted edits by Ebybymic (Talk); changed back to last version by Joey Scarr) |
|||
(4 intermediate revisions by 4 users not shown) | |||
Line 4: | Line 4: | ||
'''“'''The granule of reuse is the granule of release. Only components that are released through a tracking system can be effectively reused. This granule is the package.'''”''' | '''“'''The granule of reuse is the granule of release. Only components that are released through a tracking system can be effectively reused. This granule is the package.'''”''' | ||
− | What is | + | What is reuse? |
Copying code is not reuse. | Copying code is not reuse. | ||
If you copy or insert code/modules in to your code then you own the code. If it doesn't do what you like you have to change it. If there are bugs you have to fix them and most of all it is you who has to maintain it. | If you copy or insert code/modules in to your code then you own the code. If it doesn't do what you like you have to change it. If there are bugs you have to fix them and most of all it is you who has to maintain it. | ||
− | "I reuse code if, and only if, I never have to look at the source code." ... "Thus i can reuse nothing that is not also released." | + | "I reuse code if, and only if, I never have to look at the source code." ... "Thus i can reuse nothing that is not also released." [[Robert Cecil Martin 1996b]] |
Line 15: | Line 15: | ||
A package provides a set of functions required by the design contract. Hence it is treated as a functional unit. If other application needs such a function sets, then the package is put into place to serve the functionalities required by design. | A package provides a set of functions required by the design contract. Hence it is treated as a functional unit. If other application needs such a function sets, then the package is put into place to serve the functionalities required by design. | ||
− | Why | + | Why not use the class as the functional unit? Classes are considered too small if proper OO principles are used in a design. A set of functionalities are always provided by more than one class. In this case, the emphasis is “functional unit” rather than physical code unit, hence package is commonly the better candidate both in theory and in practice. |
More information can be found in Robert C Martin's book: Agile Software Development, Principles, Patterns, and Practices (2003) published by Pearson. (http://www.pearsonhighered.com/academic/product/0,,0135974445,00%2Ben-USS_01DBC.html) | More information can be found in Robert C Martin's book: Agile Software Development, Principles, Patterns, and Practices (2003) published by Pearson. (http://www.pearsonhighered.com/academic/product/0,,0135974445,00%2Ben-USS_01DBC.html) | ||
+ | |||
+ | [[Category:Bob Martin's principles]] |
Latest revision as of 03:22, 25 November 2010
The Reuse/Release Equivalency Principle is:
“The granule of reuse is the granule of release. Only components that are released through a tracking system can be effectively reused. This granule is the package.”
What is reuse? Copying code is not reuse. If you copy or insert code/modules in to your code then you own the code. If it doesn't do what you like you have to change it. If there are bugs you have to fix them and most of all it is you who has to maintain it.
"I reuse code if, and only if, I never have to look at the source code." ... "Thus i can reuse nothing that is not also released." Robert Cecil Martin 1996b
Package is used as the unit of distributing a software system. When one of the components in the software system want to be reused in other applications, then package is the concrete unit that should be used.
A package provides a set of functions required by the design contract. Hence it is treated as a functional unit. If other application needs such a function sets, then the package is put into place to serve the functionalities required by design.
Why not use the class as the functional unit? Classes are considered too small if proper OO principles are used in a design. A set of functionalities are always provided by more than one class. In this case, the emphasis is “functional unit” rather than physical code unit, hence package is commonly the better candidate both in theory and in practice.
More information can be found in Robert C Martin's book: Agile Software Development, Principles, Patterns, and Practices (2003) published by Pearson. (http://www.pearsonhighered.com/academic/product/0,,0135974445,00%2Ben-USS_01DBC.html)