juan_gandhi: (Default)
[personal profile] juan_gandhi
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]

Date: 2007-11-13 12:33 am (UTC)
From: [identity profile] xryun-porosyan.livejournal.com
In many cases #3 may contradict with "an object should avoid invoking methods of a member object returned by another method".

Another method might as well be a factory method, i.e. a method responsible for the creation/instantiation of a new object.

Date: 2007-11-13 03:24 pm (UTC)
From: [identity profile] sab123.livejournal.com
If an object's methods are not to be called, most of the time that object should not be returned/exposed at all.

Profile

juan_gandhi: (Default)
Juan-Carlos Gandhi

May 2025

S M T W T F S
    1 2 3
456 7 8 9 10
11 121314151617
181920 21 222324
25262728293031

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated May. 22nd, 2025 10:35 pm
Powered by Dreamwidth Studios