Reuse release equivalence principle - CSSEMediaWiki
"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.
Read full article from Reuse release equivalence principle - CSSEMediaWiki
No comments:
Post a Comment