reuse/release equivalence principle

The Reuse/Release Equivalence Principle

reuse/release equivalence principle

 

Yesterday we kicked off our journey into The Component Principles. We learned that these principles came in two flavours: Cohesion Principles and Coupling Principles: 

  • Cohesion Principles concern themselves with how we should combine modules into components
  • Coupling Principles guide us into how components should interact.

Today we’ll tackle the first of three cohesion principles: The Reuse/Release Equivalence Principle (REP).

Robert C. Martin (aka Uncle Bob) in his excellent book ‘Clean Architecture’ defines the REP as

“The granule of reuse is the granule of release.” 

As Uncle Bob points out, we live in a time of software reuse. Developers and software companies write reusable libraries so we can extend the capabilities of our programs. The modules inside these libraries will make the library useful and reusable

Simultaneously, all the modules in the library are also releasable together. We would not want to add a further, unrelated module to the library as it would be unnecessary. Similarly, all modules currently in the library are required for the library to work as intended—take one module away, and the library will no longer work. 

The REP encourages us to combine our modules into components as if we were creating a reusable library: All the modules in the component should ‘make sense’.

It’s easier to observe violations of the REP than adherence—some of the modules seem out of place and don’t gel with the component’s overarching purpose.

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply