Difference between composition and aggregation, JAVA Programming

Aggregation

Composition

Aggregation :  An  association   in  which  one  class refers to collection or a another class. This is a part of  a  whole   relationship  where  the  phase   can  exist without the whole .

e.g.: A line item is whole and the products are the phases. If a line item is deleted then the products have not be deleted .

Composition :  An  association   in  which  one  class  refers  to another class or a collection. This is a part of a whole relationship where  the  phase   cannot  implement  without  the  whole .  If  the  whole  is deleted then the parts are deleted.  For example:  An Order is a whole and the line items are the phase. If an order is removed then all the line items should be deleted as well.

Aggregations are not used to be circular.

In  a  garbage-collected  language  like  Java,  The  whole   has  the responsibility of  operating   the  garbage  collector  to  prematurely collect the part by holding reference to it.

Posted Date: 7/27/2012 5:30:44 AM | Location : United States







Related Discussions:- Difference between composition and aggregation, Assignment Help, Ask Question on Difference between composition and aggregation, Get Answer, Expert's Help, Difference between composition and aggregation Discussions

Write discussion on Difference between composition and aggregation
Your posts are moderated
Related Questions
Prepare Neo4j database of airline airports and routes. Implement Dijkstra algorithm to evaluate shortest path for flights with available seats. I'm need a developer with Neo4j/g

Design and implement a class called Sphere that contains instance data that represents the sphere''s diameter, and include getter and setter methods for the diameter. Include metho

Advice is the execution of an aspect. It is something like telling your application of a new behavior. Generally, and advice is inserted into an application at joinpoints

how to implement tsp problem using java applet to present in form of visulation

Write a program called Grid. The program starts by prompting (asking) the user for the name of an input text file. This file is guaranteed to be correct and has the following fo

Explain Testing for Equality with equals? That's not what you expected. To contrast strings or any other kind of object you required to use the equals(Object o) techniques from

Project Description: Our project consists of a plain application, both for iPad/iOS (Newsstand app) and Android 4.x which will download PDF magazines from the internet, after ha

To use the DispatchAction, follow these steps: ? Make a class that extends DispatchAction (instead of Action) ? In a new class, add a method for each function you need to per

We need a serious programmer who will code Java and Javascript in Liferay - open to bidding Project Description: Big Data project Prototype in Liferay. Big Data + User onl

Project Description: We need same kind of concept with some changes # Change single colors in a particular design. you need to be able to change the color of only the fox or