You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
*[Law of Demeter - Wikipedia](https://en.wikipedia.org/wiki/Law_of_Demeter)
4
+
*[Law of Demeter - WikiWikiWeb](https://wiki.c2.com/?LawOfDemeter)
5
+
*[Introducing Demeter and its Laws](http://www.bradapp.net/docs/demeter-intro.html)
4
6
7
+
## Mnemonic for the Law of Demeter
8
+
The post [Visualization Mnemonics for Software Principles](http://www.daedtech.com/visualization-mnemonics-for-software-principles) by [Erik Dietrich](https://github.com/erikdietrich) provides a very effective trick to understand (and never forget anymore) what the Law of Demeter is. An Italian translation is available [here](https://github.com/arialdomartini/mnemonics/blob/law-of-demeter/README-italian.md).
9
+
10
+
## Code Example
11
+
An example of code violating the Law of Demeter is provided by [Krzysztof Grzybek](https://github.com/krzysztof-grzybek)
5
12
6
-
Code violating The Law of Demeter:
7
13
```javascript
8
14
classPlane {
9
15
constructor(crew) {
@@ -27,6 +33,7 @@ class Pilot {
27
33
}
28
34
}
29
35
```
36
+
30
37
It's bad, because it creates tight coupling between objects - they are dependent on internal structure of other objects.
0 commit comments