CCP (the common closure principle)
All classes in the package should be closed for changes to the same class nature.
The classes in a package shoshould be closed together against the same kinds of changes. A change that affects a package affects all the classes in that package.
All classes in a package should be disabled for changes of the same type. A change affects a package and affects all classes in the package.
A more brief statement is:
Classes that change together, belong together.
Classes modified together should be combined (in the same package ).
If you have to modify the code in the application, we want all the modifications to occur in a package (change to close) instead of in many packages.
The CCP principle is to combine all classes that need to be modified for the same reason into a package. If the two classes are physically or conceptually closely related and they change together, they should belong to the same package.
CCP has a deep relationship with the principle of open and closed (OCP: open closed principle). Closure is what OCP advocates: classes shoshould be closed for modification but open for extension. class should be closed for modification and open for extension. But we know that 100% of the "close" is unrealistic. When designing a system, we can only try to keep the most foreseeable changes closed.
The CCP extends the "close" concept of OCP. When you need to modify it for some reason, you must restrict the scope to be modified to a minimum package.
The CCP principle helps us determine which classes should be placed in the same package.