<s>
The	B-Application
Law	I-Application
of	I-Application
Demeter	I-Application
(	O
LoD	O
)	O
or	O
principle	B-Application
of	I-Application
least	I-Application
knowledge	I-Application
is	O
a	O
design	O
guideline	O
for	O
developing	O
software	O
,	O
particularly	O
object-oriented	B-Language
programs	I-Language
.	O
</s>
<s>
In	O
its	O
general	O
form	O
,	O
the	O
LoD	O
is	O
a	O
specific	O
case	O
of	O
loose	B-Application
coupling	I-Application
.	O
</s>
<s>
The	O
fundamental	O
notion	O
is	O
that	O
a	O
given	O
object	O
should	O
assume	O
as	O
little	O
as	O
possible	O
about	O
the	O
structure	O
or	O
properties	O
of	O
anything	O
else	O
(	O
including	O
its	O
subcomponents	O
)	O
,	O
in	O
accordance	O
with	O
the	O
principle	O
of	O
"	O
information	B-Application
hiding	I-Application
"	O
.	O
</s>
<s>
It	O
is	O
so	O
named	O
for	O
its	O
origin	O
in	O
the	O
Demeter	O
Project	O
,	O
an	O
adaptive	O
programming	O
and	O
aspect-oriented	B-Architecture
programming	I-Architecture
effort	O
.	O
</s>
<s>
The	O
Demeter	O
Project	O
was	O
the	O
birthplace	O
of	O
a	O
lot	O
of	O
AOP	B-Architecture
(	O
Aspect	B-Architecture
Oriented	I-Architecture
Programming	I-Architecture
)	O
principles	O
.	O
</s>
<s>
More	O
formally	O
,	O
the	B-Application
Law	I-Application
of	I-Application
Demeter	I-Application
for	O
functions	O
requires	O
that	O
a	O
method	O
m	O
of	O
an	O
object	O
a	O
may	O
only	O
invoke	O
the	O
methods	O
of	O
the	O
following	O
kinds	O
of	O
objects	O
:	O
</s>
<s>
For	O
many	O
modern	O
object	B-Language
oriented	I-Language
languages	I-Language
that	O
use	O
a	O
dot	O
as	O
field	O
identifier	O
,	O
the	O
law	O
can	O
be	O
stated	O
simply	O
as	O
"	O
use	O
only	O
one	O
dot	O
"	O
.	O
</s>
<s>
The	O
advantage	O
of	O
following	O
the	B-Application
Law	I-Application
of	I-Application
Demeter	I-Application
is	O
that	O
the	O
resulting	O
software	O
tends	O
to	O
be	O
more	O
maintainable	O
and	O
adaptable	O
.	O
</s>
<s>
Since	O
objects	O
are	O
less	B-Application
dependent	I-Application
on	O
the	O
internal	O
structure	O
of	O
other	O
objects	O
,	O
object	O
implementation	O
can	O
be	O
changed	O
without	O
reworking	O
their	O
callers	O
.	O
</s>
<s>
published	O
experimental	O
results	O
in	O
1996	O
suggesting	O
that	O
a	O
lower	O
Response	O
For	O
a	O
Class	O
(	O
RFC	O
,	O
the	O
number	O
of	O
methods	O
potentially	O
invoked	O
in	O
response	O
to	O
calling	O
a	O
method	O
of	O
that	O
class	O
)	O
can	O
reduce	O
the	O
probability	O
of	O
software	B-Error_Name
bugs	I-Error_Name
.	O
</s>
<s>
Following	O
the	B-Application
Law	I-Application
of	I-Application
Demeter	I-Application
can	O
result	O
in	O
a	O
lower	O
RFC	O
.	O
</s>
<s>
However	O
,	O
the	O
results	O
also	O
suggest	O
that	O
an	O
increase	O
in	O
Weighted	O
Methods	O
per	O
Class	O
(	O
WMC	O
,	O
the	O
number	O
of	O
methods	O
defined	O
in	O
each	O
class	O
)	O
can	O
increase	O
the	O
probability	O
of	O
software	B-Error_Name
bugs	I-Error_Name
.	O
</s>
<s>
Following	O
the	B-Application
Law	I-Application
of	I-Application
Demeter	I-Application
can	O
also	O
result	O
in	O
a	O
higher	O
WMC	O
.	O
</s>
<s>
A	O
multilayered	B-Operating_System
architecture	I-Operating_System
can	O
be	O
considered	O
to	O
be	O
a	O
systematic	O
mechanism	O
for	O
implementing	O
the	B-Application
Law	I-Application
of	I-Application
Demeter	I-Application
in	O
a	O
software	O
system	O
.	O
</s>
<s>
In	O
a	O
layered	O
architecture	O
,	O
code	O
within	O
each	O
layer	B-Application
can	O
only	O
make	O
calls	O
to	O
code	O
within	O
the	O
layer	B-Application
and	O
code	O
within	O
the	O
next	O
layer	B-Application
down	O
.	O
</s>
<s>
"	O
Layer	B-Application
skipping	O
"	O
would	O
violate	O
the	O
layered	O
architecture	O
.	O
</s>
<s>
If	O
a	O
wrapper	O
method	O
is	O
being	O
used	O
,	O
it	O
means	O
that	O
the	O
object	O
being	O
called	O
through	O
the	O
wrapper	O
should	O
have	O
been	O
a	O
dependency	B-Application
in	O
the	O
calling	O
class	O
.	O
</s>
<s>
One	O
proposed	O
solution	O
to	O
the	O
problem	O
of	O
enlarged	O
class	O
interfaces	O
is	O
the	O
aspect-oriented	B-Architecture
approach	O
,	O
where	O
the	O
behavior	O
of	O
the	O
method	O
is	O
specified	O
as	O
an	O
aspect	O
at	O
a	O
high	O
level	O
of	O
abstraction	O
.	O
</s>
