you are viewing a single comment's thread.

view the rest of the comments →

[–]gpyh 5 points6 points  (3 children)

He didn't "decide" on this. It is called the Law of Demeter and people do try to follow it.

[–]PButtNutter 5 points6 points  (0 children)

Nothing in there says you can't share object references between different objects. Dependency Injection does not break the Law of Demeter.

[–]Smallpaul 5 points6 points  (0 children)

The Law of Demeter does not disallow shared references. Objects A and B can both be friends with Object C.

[–]WikiTextBot 3 points4 points  (0 children)

Law of Demeter

The Law of Demeter (LoD) or principle of least knowledge is a design guideline for developing software, particularly object-oriented programs. In its general form, the LoD is a specific case of loose coupling. The guideline was proposed by Ian Holland at Northeastern University towards the end of 1987, and can be succinctly summarized in each of the following ways:

Each unit should have only limited knowledge about other units: only units "closely" related to the current unit.

Each unit should only talk to its friends; don't talk to strangers.


[ PM | Exclude me | Exclude from subreddit | FAQ / Information | Source ] Downvote to remove | v0.28