Cohesion and Coupling: Two OO Design Principles

Cohesion and Coupling deal with the quality of an OO design. Generally, good OO design should be loosely coupled and highly cohesive. Lot of the design principles, design patterns which have been created are based on the idea of “Loose coupling and high cohesion”.

The aim of the design should be to make the application:

  • easier to develop
  • easier to maintain
  • easier to add new features
  • less Fragile.

Coupling:

Coupling is the degree to which one class knows about another class. Let us consider two classes class A and class B. If class A knows class B through its interface only i.e it interacts with class B through its API then class A and class B are said to be loosely coupled.

Continue reading “Cohesion and Coupling: Two OO Design Principles”