SE450
:
Law of Demeter
[29/57]
Example: Mail system in chapter 2
Mailbox currentMailbox = mailSystem.findMailbox(...);
Breaks encapsulation
Suppose future version of
MailSystem
uses a database
Then it no longer has mailbox objects
Common in larger systems
Karl Lieberherr: Law of Demeter
Demeter = Greek goddess of agriculture, sister of Zeus