What is this programming rule called?

There is a programming rule that says that instead of asking for "x" when it needs to know "xyz", a method should ask for "z" directly. I just can't remember the name.

+1


a source to share


3 answers


I'm not sure if this is exactly what you want, but it sounds a lot like the Law of Demeter .



+7


a source


It is known as the Law of Demeter (aka The Principle of Least Knowledge). See http://en.wikipedia.org/wiki/Law_of_Demeter .



The clearest and most memorable illustration of this I have heard: "When you pay for a purchase in a store, the clerk does not ask you for your wallet so that they can retrieve the money, they ask you for money!"

+7


a source


Are you thinking about the Law of Demeter?

+3


a source







All Articles