Opentopia Directory Encyclopedia Tools

Object association

Encyclopedia : O : OB : OBJ : Object association


In object-oriented programming, there are two kinds of object association, aggregation and composition. Both intend to do the same thing, build "large" objects from "smaller" ones. They differ only conceptually, from an object system perspective.

In the object-oriented programming paradigm, the word association means union. In object association, one object is formed from the union of two or more other objects.

Aggregation

Aggregation is the association of objects that have functionality by themselves to create a more complex object. For example, suppose you have the objects TV, couch, and shelf. Those objects are useful by themselves. However, by combining them, you can create a living room object which has more functionality.

Composition

Composition is the association of objects that have no functionality of their own to create compound objects with real functions.

For example, the objects wheel, steering wheel, seat, gearbox and engine may have no functionality by themselves, but if you composite them, they may form an automobile object, which has a real function.

 


From Wikipedia, the Free Encyclopedia. Original article here. Support Wikipedia by contributing or donating.
All text is available under the terms of the GNU Free Documentation License See Wikipedia Copyrights for details.

Search Titles
0123456789
ABCDEFGHIJ
KLMNOPQRST
UVWXYZ?

E-mail this article to:

Personal Message: