Component Cohesion
Clean Code: Component Design, Episode 16
Robert "Uncle Bob" Martin
55 minutes • 1.10GB • Jan 2013
Sticky, icky, gooey! Cohesion. That's what this one's all about: Component Cohesion.
How and why do components cohere? What are the good forces of component cohesion, and what are the bad forces? Which classes belong together in components, and which should be kept apart?
Oh, and why do White Dwarf stars go Supernova?
In this episode we're going to explore the three principles of component cohesion:
The Release Reuse Equivalence principle
The Common Closure Principle
The Common Reuse Principle
We'll learn about the goal of independent deployability, and why that goal causes certain classes to belong together while other classes don't.
We'll also learn about the forces of false cohesion that tempt us to group classes together into ineffective components that aren't independently deployable.
We'll see, first hand, the eerie connection between the component principles and the SOLID principles.
We'll see how components are governed by release procedures, by actors and their responsibilities, and also by how much knowledge they present to their users.
And we'll discover that the component structure of a system is a function of its maturity as well as of its behavior. We'll see that the component principles have a certain mutual exclusivity that creates a tension in the component structure.
So get a rag and some acetone, because we've got a lot of gooeyness to deal with as we slurp our way through the topic of component cohesion.