Comparison
CohesionvsCoupling
Cohesion
the code for one job is spread over four files, and each of those files also does three unrelated jobs.
How much the things inside one module belong together. High cohesion means a module has one reason to exist and everything in it serves that reason; low cohesion means the module is a drawer. It matters because cohesion is what makes a boundary findable: when the code that changes together lives together, a feature is one file to open rather than a search across the repository.
Full entry →Coupling
you changed one module and three tests in a directory you had never opened went red.
How much one part of a system has to know about another part to work. Every dependency is coupling and some of it is necessary; the question in a review is never whether two things are coupled but whether they are coupled through a stable contract or through an assumption that will move. High coupling is what makes a small change expensive, because the cost of the change is not the edit but everything the edit forces you to also understand.
Full entry →