Google
 
   
Login
Username:

Password:


Lost Password?

Register now!
Search
Main Menu
service
top books
Polls
What do you think about php-deluxe.net?
Excellent!
Cool
Hmm..not bad
What the hell is this?
encyclopedia
recommendation
Freenet DSL
Who's Online
12 user(s) are online (12 user(s) are browsing encyclopedia)

Members: 0
Guests: 12

more...
partner

Consultation (object-oriented programming)

Consultation in object-oriented programming occurs when an object s method implementation consists of a message send of the same message to another constituent object.

= Example =

class CustomerList { List customers = new ArrayList(); public void add(Customer customer) { customers.add(customer); // this is a consultation } }

In this example, the add method of CustomerList consults the List instance to implement the semantics of adding a value to the list. Consultation can be very useful if extra conditions or side-effects have to occur on the method invocations. For instance in this example, the add method can be used to check if the customer is not yet in the list, and to check for non-null customer object.

= Delegation =

Consultation is often incorrectly referred to as Delegation (programming). The main differences with delegation are that consultation is explicit in the code not a language mechanism as such, and that consultation does not preserve late binding of self whereas delegation does.