Sustainable Software Design: Understanding the Benefits of the Common Closure Principle
What?
The Common Closure Principle (CCP) states:” The components’ classes should be closed against the same kind of changes. A change that affects a part affects all the classes in that component and no other components.”
In other words, a component should not have multiple reasons to change. The Single Responsibility Principle (SRP) from SOLID is restated for parts.
Why?
The goal of CCP is to increase maintainability. If a change to requirements always triggers changes in many components, it will be harder to make the change. Each change will lead to much re-validation and redeploying, and parallelizing different changes will be more challenging.
You would prefer the changes to occur in one component only.
For the full article, please visit https://ericbackhage.net/clean-code/the-common-closure-principle/. At Eric Bäckhage’s blog https://ericbackhage.net/