Software
Quality

Share, improve, learn, co-operate on topics related to
software quality assurance.

Saturday, September 17, 2005

Law of Demeter (LoD), Low Coupling

One of the bigger challenges in software
engineering is keeping the complexity of the design under control. Two major
techniques to reduce complexity are reducing
coupling and increasing the cohesion of the software
components/objects/methods.

The Law of
Demeter is a style rule for designing
object-oriented systems. "Only talk to your immediate friends". The rule
was discovered at Northeastern University in 1987 by Ian Holland.

A more
general formulation of the Law of Demeter is:
Each unit should have only limited knowledge about other units: only units
"closely" related to the current unit. Or: Each unit should only talk to its
friends; Don't talk to strangers.

The LoD is a more specific case
of the Low Coupling Principle well-known
in software engineering. The Low Coupling Principle is very general. The benefit
of the Law of Demeter is that it makes the notion of unnecessary coupling very
explicit.

The main motivation for
the Law of Demeter is to control information
overload; we can only keep a limited set of items in short-term memory
and it is easier to keep them in memory if they are closely
related.

Rumbaugh summarizes the
Law of Demeter as: A method should have limited
knowledge of an object model. This view leads to aspect-oriented programming: we pull out the
method and transitively all its auxiliary methods into a separate aspect. This
works best if the separate aspect has limited knowledge about the object
model.

Read more on the Northeastern University page
on the Law of Demeter

posted by Ronny De Winter at Saturday,
September 17, 2005

0 Comments:

Post
a Comment

Read more about Software Quality at the <<Software Quality Weblog
Home

Blog Feed

Links

Amazon
on software quality

Google on
software quality

Previous Posts

SOA,
4 Steps, 7 Principles

Test
Driven Project Management

Software
Health versus Software Quality

ISO9126
Software Quality Attributes

Scrum
is easy, Scrum is hard

Evaluating
Open Source Software

Managing
Complexity and Uncertainty

Customer
Test Driven Development (CTDD)

10
Success Criteria For Software Development

10
Critical Quality Assurance Traps

Archives

April
2005

May
2005

June
2005

July
2005

August
2005

September
2005

October
2005

November
2005

December
2005

January
2006

March
2006

April
2006

May
2006

August
2006

October
2006

Ronny De Winter

A software engineering professional with special interest in software
quality