Low-coupling / High-cohesion Pattern

In computer science, the Low-Coupling / High-Cohesion isn't a specific pattern amongst design patterns. It's a general method for structuring programs so that they're simpler to understand, program and mantain. This concepts (Low-Coupling / High-Cohesion) are usually related. Low coupling implies high cohesion and viceversa, because if we put together all relationed methods (High Cohesion), the connection between classes tends to get lower (Low Coupling).

Low Coupling

Coupling is a measure of how strongly one class is connected to another and is increased between Class A and Class B when:
  • A has an attribute that refers to (is of type) B.
  • A calls on services of a B object.
  • A has a method which references B (via return type or parameter).
  • A is a subclass of (or implements) B.
The disadvantages of high coupling includes:
  • A change in one class forces a ripple of changes in other classes.
  • Difficult to understand a class in isolation.
  • Difficult to reuse a class because dependent class must also be included.

High Cohesion

If we want to design classes to increase the likelihood of reuse and not be overwhelmingly complex, keeping complexity manageable, the solution is assigning responsibilities so that cohesion remains high. Cohesion is a measure of how strongly related and focused the responsibilities of a single class are. Cohesion is decreased when:
  • The responsibilities (operations) of a class have little in common.
  • Operations do many varied activities, often using varied data.
The disadvantages of weak cohesion are:
  • Difficult to understand.
  • Difficult to maintain, beacause it is constantly effected by changes.
  • Difficult to reuse a class because most application wont need a random set of operations attached to a class.

 

<< PreviousWord BrowserNext >>
danish parliamentary election, 1957
danish parliamentary election, 1960
danish parliamentary election, 22. september 1953
weak tie
luckenbooth brooch
duration (disambiguation)
cardinal eduardo martnez somalo
skiboarding
minor characters associated with quidditch
raf butzweilerhof
dog logan
first european settlement in america
androminetophilia
coco bongo
vaiben solomon
martyazo
mashavera
sunset yellow
hindustan times
lingual tonsils
nine sisters
the new haven register
flags of brazilian states
theater (structure)
directrevenue
innova junior college
campbellton, georgia
gopherlog
landing at suvla bay
tony atlas
tammy lynn sytch
tod gordon
johnny weiss
jasper ridge biological preserve
the shocking blue
rocky johnson
the grand wizard
santa claus, arizona
harry fujiwara
coyhaique
james mangold
teesra
san bernadino asistencia
ivan putski