Giving Demeter PTSD
The law of Demeter goes like this, a method
m of an object
O may only invoke the methods of the following kinds of objects:
- Any objects created/instantiated within
O's direct component objects
- A global variable, accessible by
O, in the scope of
And then we have this snippet from a 1,741 lines index that was sent to us to diagnose some performance problems.
There are at least two separate leaks of customer data here, by the way, can you spot them?
This is it for this post, I really don’t have anything else left to say.