Coupling and Cohesion: Confounding Yet Critical Concepts

A deep but often-overlooked problem that perennially plagues software is that of high coupling and/or low cohesion. The underlying concepts are foundational to good software engineering, as they impact how hard it will be to comprehend, extend, and maintain a particular piece of software. Yet they can be quite confusing, and attempts to deal with them can be very misguided. Because a shallow understanding can do more harm than no understanding at all, the subtleties of these related concepts need to be explored.

To review very briefly, coupling is the degree to which distinct classes, modules, etc., are tied together, such that a change to one requires changes to others. Cohesion is the degree to which a class or component deals with just one thing. But rather than thinking of cohesion as tight internal coupling, think of it as the conceptual purity of a unit of software. This avoids some misunderstandings that can arise otherwise. I won't dwell further on the definitions, as others have done a good job of that.