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:
O
itselfm
's parameters- Any objects created/instantiated within
m
O
's direct component objects- A global variable, accessible by
O
, in the scope ofm
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.
Comments
I had to check the date, I thought we were 1st of April
Comment preview