Software Engineering Topic of the Day #53

Credit: Originally written and published by Tom Oram on Armakuni’s internal Slack

Photo by Kira auf der Heide via Upsplash

Common-Reuse Principle (CRP)

The second cohesion package principle states:

The classes in a package are reused together. If you reuse one of the classes in a package, you reuse them all.

This is very closely related to the Reuse-Release Equivalence Principle. In means that if you code depends on a class in the package, then is should depend on all the classes in the package. Part of the goal here is to push unrelated classes out and into separate packages.

Q1: Do you packages generally conform to this principle?

Q2: How does deciding what belongs in a class compare to what belongs in a package?