[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

The Law of Demeter

Concerning the Law: You say that function calls inside a method M
should use only certain objects as method selection arguments.

How does the programmer know what arguments a function will use to
dispatch according to type? How does the programmer know that a
function is generic and will do such a dispatch?

You say the Law prohibits functional composition of accessor functions
which return non-slot objects.

How does the programmer know that a function-call is a slot-access?

You say it's okay to use objects that are created by the method in
question, or by a function that it calls.

How does the programmer know that an object returned by a function is

It seems that in order to use the Law, the programmer must have
knowledge which violates an even older law: That of information-hiding.