previous | start | next

## Law of Demeter

- 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

previous | start | next