Dependencies between Objects
Dependencies are not bad. In fact, they often represent a very realistic view of the world. Imagine that you had a room containing a person and a chair. When you send the person the message "sit," you want the person to sit on a chair. The person and the chair are both encapsulated by the room. They are sibling objects. When a person sits on the chair, he is not encapsulated by the chair (you do not send messages to the person via the chair). Before a person can sit down, they must have a chair they can use. There is a dependency between the person and the chair. From an OO perspective, the person object will ask its parent object, the room, to provide a chair object that it can use. If the chair is not available, the person will not be able to sit. You have a dependency between objects.
If our person must send a message to the chair, it could do it by sending the message:
Send Message of (oMyChair(Parent(self)))
(This is an example of a sibling sending a message to a second sibling.) We can let delegation do some of our work for us and simplify the expression to:
Send Message of oMyChair
Often, you will want an object to remember the object ID of the object that it depends on. Once an association has been established between objects, you may wish for the objects to communicate directly. The person object could do this by defining a property named phoChair. When the person enters the room, it could ask the room object for its chair object and place this object ID in the phoChair property. When the person needs to send a message to the chair, it can now send the message directly to the chair. This will make continued communication between these objects faster.
Within a view, there are dependencies between DDOs. There are also dependencies between DEOs and DDOs. We are provided with a method of establishing these dependencies when we create each DDO and DEO. The dependency between two DDOs is referred to as an updating (set ddo_server) dependency. The dependency between a DEO and a DDO is referred to as a using (set server) dependency.