ArjanCodes
26 minutes
Cohesion is the degree to which the elements of a class or function belong together, and strong cohesion means a single clear responsibility. Coupling is a measure of how dependent two parts of code are on each other, so changes in one force changes in the other. Good design seeks high cohesion and low coupling, achieved by locating behavior next to the data it uses (the Information Expert idea from the GRASP principles) and separating distinct kinds of information. These are software quality metrics in software design that apply to any programming language, but they are judged by developers rather than computed.