Common reuse principle
From CSSEMediaWiki
(Difference between revisions)
(New page: From {{Ref|1}}: <blockquote> [It] is very important to decide which classes should be bound together by a package. Improper selection of classes can create unwanted dependencies and turn u...) |
m (Reverted edits by Ebybymic (Talk); changed back to last version by Joey Scarr) |
||
(8 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
From {{Ref|1}}: | From {{Ref|1}}: | ||
+ | |||
+ | <blockquote>The classes in a package are reused together. If you reuse one of the classes in a package, you reuse them all.</blockquote> | ||
+ | |||
+ | This means: "The classes that tend to be reused together belong in the same package",[[Robert Cecil Martin 1996b]] | ||
+ | |||
<blockquote> | <blockquote> | ||
[It] is very important to decide which classes should be bound together by a package. Improper selection of classes can create unwanted dependencies and turn usage of that package into a nightmare. [The] Common Reuse Principle (CRP) lays down a good foundation to determine which classes should be packaged together: The classes in a package are reused together. If you reuse one of the classes in a package, you reuse them all. It says that only cohesive classes should be packaged together. As with everything, the packaging of classes and the cohesiveness should be defined from the user’s perspective. If a user uses a package, all the classes in that package should be reusable in the same context. | [It] is very important to decide which classes should be bound together by a package. Improper selection of classes can create unwanted dependencies and turn usage of that package into a nightmare. [The] Common Reuse Principle (CRP) lays down a good foundation to determine which classes should be packaged together: The classes in a package are reused together. If you reuse one of the classes in a package, you reuse them all. It says that only cohesive classes should be packaged together. As with everything, the packaging of classes and the cohesiveness should be defined from the user’s perspective. If a user uses a package, all the classes in that package should be reusable in the same context. | ||
Line 6: | Line 11: | ||
==References== | ==References== | ||
#{{Note|1}} http://iface.wordpress.com/2006/04/05/common-reuse-principle/ | #{{Note|1}} http://iface.wordpress.com/2006/04/05/common-reuse-principle/ | ||
+ | |||
+ | ==See Also== | ||
+ | *[[Common closure principle]] | ||
+ | *[[Reuse release equivalence principle]] | ||
+ | |||
+ | [[Category:Pages that need examples]] | ||
+ | [[Category:Bob Martin's principles]] |
Latest revision as of 03:18, 25 November 2010
From [1]:
The classes in a package are reused together. If you reuse one of the classes in a package, you reuse them all.
This means: "The classes that tend to be reused together belong in the same package",Robert Cecil Martin 1996b
[It] is very important to decide which classes should be bound together by a package. Improper selection of classes can create unwanted dependencies and turn usage of that package into a nightmare. [The] Common Reuse Principle (CRP) lays down a good foundation to determine which classes should be packaged together: The classes in a package are reused together. If you reuse one of the classes in a package, you reuse them all. It says that only cohesive classes should be packaged together. As with everything, the packaging of classes and the cohesiveness should be defined from the user’s perspective. If a user uses a package, all the classes in that package should be reusable in the same context.