Law of demeter
Nov. 12th, 2007 03:04 pm![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
Intro:
The Law of Demeter for functions requires that a method M of an object O may only invoke the methods of the following kinds of objects:
1. O itself
2. M's parameters
3. any objects created/instantiated within M
4. O's direct component objects
In particular, an object should avoid invoking methods of a member object returned by another method.
[Poll #1087502]
The Law of Demeter for functions requires that a method M of an object O may only invoke the methods of the following kinds of objects:
1. O itself
2. M's parameters
3. any objects created/instantiated within M
4. O's direct component objects
In particular, an object should avoid invoking methods of a member object returned by another method.
[Poll #1087502]
no subject
Date: 2007-11-13 12:33 am (UTC)Another method might as well be a factory method, i.e. a method responsible for the creation/instantiation of a new object.
no subject
Date: 2007-11-13 03:24 pm (UTC)