UML - aggregation and association practical difference
Hi, please is anybody here who can explain me the difference between aggregation and association in UML on some concrete C# example? I was looking on many websites for answer but everybody answers by theoretical examples like tree has a leaf and so on, but i still dont understand it, cos i dont know how it looks like in real code! for examle:
public class SomeClass {
private int someInt;
private AnotherClass anotherClass;
}
What kind of relationship is between someClass and anotherClass? can you provide me code examples for all types of class relationship: association, aggregation, composition, generalization? MANY THANKS
jingePosted Oct 22, 2009, 10:23 PM
Master BillaPosted Oct 22, 2009, 11:40 AM
here is practical sample code given expert C# object 2008 book
http://books.google.com.sg/books?id=8n7JD5me1CUC&pg=PA135&lpg=PA135&dq=aggregation+and+association+in+C%23+example&source=bl&ots=e2AGnXmyJ6&sig=plZCH7HXIejZmo3ZxTOyNSUahZs&hl=en&ei=b3vgSvPFJZOOkQW2j8wi&sa=X&oi=book_result&ct=result&resnum=2&ved=0CAoQ6AEwAQ#v=onepage&q=aggregation%20and%20association%20in%20C%23%20example&f=false
thank you
Kirtan PatelPosted Oct 22, 2009, 10:38 AM
Friend ,
UML is Concept of Database Systems so it can be understandable by any programming language it can be only
understandable by database terminology
lets take example of Two Entity Customer and Loan
Customer ( Cust_Id,Cust_Name,Cust_Address)
and
Loan ( Loan_Id,Amount);
relation between Loan and Customer is "Customer-Loan"
here Its Relation ship between Loan and Customer_ID but we need some additional information too :) thats Transaction Date
So We can Take RelationShip "Customer-Loan" as Entity that will Store Transaction Date . so physically its entity in database but logically its Called Relationship
so here Customer-Loan is said to be associative entity :)
Aggregation
-----------------
Lets take Example
Entities are Bank , Employee ,Branch ,Manager
here each Entity has one manager
so instead of Showing relation Between each entity and Manager we can Represent Bank ,Employee ,Branch as One Group
of Entity That related to Manager By Some Relation so here to representing Group is Called Aggregation
if my answer helps you please check "Do you like this answer" :)