InterviewSolution
| 1. |
How Do I Express Aggregation In Idl? |
|
Answer» The aggregation of two objects is a very common OO design concept. Aggregation is also known as has-a and contains. Since IDL doesn't support "public data," a programmer that is using an IDL interface cannot tell whether an aggregation is actually implemented using aggregation or by some other technique. In other words, IDL is a specification language that separates interface from implementation. In particular, IDL does not support implementation constructs such as aggregation. However logical aggregation is supported by IDL: IDL lets you specify an operation that returns another interface, and this second interface could REPRESENT an object that is logically contained within the FIRST object. Whether it's actually implemented using aggregation or not is an implementation issue, not a specification issue, and the implementer can do it EITHER way without requiring any changes to the IDL interface. Note that DCOM directly supports aggregation since DCOM combines implementation issues with specification issues. The COM<->CORBA interworking specification actually maps aggregation to and from inheritance (CORBA IDL supports inheritance directly, and DCOM supports aggregation directly). The aggregation of two objects is a very common OO design concept. Aggregation is also known as has-a and contains. Since IDL doesn't support "public data," a programmer that is using an IDL interface cannot tell whether an aggregation is actually implemented using aggregation or by some other technique. In other words, IDL is a specification language that separates interface from implementation. In particular, IDL does not support implementation constructs such as aggregation. However logical aggregation is supported by IDL: IDL lets you specify an operation that returns another interface, and this second interface could represent an object that is logically contained within the first object. Whether it's actually implemented using aggregation or not is an implementation issue, not a specification issue, and the implementer can do it either way without requiring any changes to the IDL interface. Note that DCOM directly supports aggregation since DCOM combines implementation issues with specification issues. The COM<->CORBA interworking specification actually maps aggregation to and from inheritance (CORBA IDL supports inheritance directly, and DCOM supports aggregation directly). |
|