介绍一下RobertC.Martin提出的面向对象的设计原则中的闭锁性共通原则。参考文档(http://www.objectmentor.com/resources/articles/Principles_and_Patterns.pdf
)。
闭锁性共通原则(CCP):The Common Closure Principle 。是为了解决包设计的凝集问题的。
包中的所有类对于同一类性质的变化应该是共通封闭的。一个变化若对一个包产生影响,则将对该包中的所有类产生影响,而对于其他的包不造成任何影响
(
The classes in a package should be closed together against the same
kinds of changes. a change that affects a package affects all the
classes in that package.
)。
还有就是因为同一类性质的变化而被修改的类应该放在同一个包内
(Classes that change together, belong together.
)。