CS 1114 Chapter Notes - Chapter 10: Duplicate Code, Mutator Method, Loose Coupling
Document Summary
Observe ~ there are two terms that are central to describing the quality of a class design: coupling and cohesion. The degree of coupling indicates how tightly classes are connected. One should aim for loose coupling a low degree of coupling. The degree of coupling determines how difficult it is to make changes in a given application. It is advantageous to design classes in such a fashion that one small change does not result in many supplemental changes: example: tight coupling refers to the utilization of public fields and is not advantageous. Cohesion refers to the number and diversity of tasks for which a single unit of application is responsible. Cohesion is relevant for units of a single class and an individual method. In an ideal world, one unit of code should be responsible for one cohesive task (a task that can be seen as a logical unit).