law-of-demeter
Installation
SKILL.md
Law of Demeter (Don't Talk to Strangers)
Overview
Only talk to your immediate friends, not strangers.
A method should only call methods on: itself, its parameters, objects it creates, or its direct components. Never reach through an object to access another object's internals.
When to Use
- Accessing nested properties:
obj.a.b.c - Chaining method calls:
obj.getA().getB().getC() - Reaching through objects for data
- Long dot chains in your code