Principles of Package and Component Design

One of the most known set of principles regarding software design is probably SOLID. But an important part of structuring software that SOLID does not cover is how to group classes into packages and components in a way that makes it scale, both when the application itself grows but also when the number of teams and developers working with the code grows.

Fortunately this is also something that Uncle Bob has thought of and written down a number of principles on. In the next set of blog posts I will cover these principles briefly, but I do encourage you to buy a copy of either ”Agile Principles, Patterns, and Practices in C#” or ”Clean Architecture” so that you can really read up on them and look at a larger example on how they can be applied.

Uncle Bob has written down six different principles on package and component design. Three of them targets package cohesion, and the other three governs package coupling. They are called:

  • The Reuse/Release Equivalence Principle (REP)
  • The Common Reuse Principle (CRP)
  • The Common Closure Principle (CCP)
  • The Acyclic Dependencies Principle (ADP)
  • The Stable-Dependencies Principle (SDP)
  • The Stable-Abstractions Principle (SAP)

I will write about them in that order, starting with REP and ending with SAP.

Oh, and by the way. In .NET a component is called an Assembly and is usually carried in a DLL.