Wednesday, August 3, 2016

The Law of Demeter (LoD) flashback

Violations of the Law of Demeter make your code unreadable, hard understandable, overcrowded with extra dependencies and bad scalable...

Low of Demeter

Each unit should have only limited knowledge about other units: only units "closely" related to the current unit
- general formulation
Don't talk to strangers! - short form of law
Means each unit should talk only to its friends.
Use only one dot. - simplified form
This is the tricky one: It's only in common, don't confuse when using 'builders', 'factoryMethods', etc.

No comments:

Post a Comment