Sign up UML association vs. composition and detail level
UML 2016. 10. 13. 10:39Actually, make that a couple of amateur UML questions! When creating a UML diagram to model some domain concepts and you come across a domain concept that "holds" some information about another concept, is it better to hold a stamp/reference to that entity or hold the whole entity in the model itself? Please bear in mind that this is relating to creating a simple high-level model - I'm sure in the implementation stage things would be slightly different.
For example, which of the two models below is actually correct? The first one has a composition relationship, with FlightBooking holding the whole of Flight. In the second one, FlightBooking just has a reference to Flight.
Secondly, when creating a high level UML diagram modelling domain concepts, how much detail are you really meant to go? For example, in the diagram below, a flight could hold details about origin/destination as strings, or I could model separate classes for these concepts and create a composition relationship. Which of the two is advisable?
Also, just another thing, when modelling the above where a Flight "holds" an orig/destination as another class rather than a string, which of the two ways is the correct way of modelling this? I'm quite confused as to when to show assosciation and when to show composition.
A
Association :
It means two classes have some kind of relationship, could be anything really.
E.g : A uses B, A is related to B in a given way.
Composition :
This is also a special type of association used for modelling 'Ownership'. This is very similar to Aggregation with the only difference that it depicts a Whole-part relationship and the 'part' entity doesn't have its own independent existence
E.g : A consists of B; B is a part of A and hence cannot exist without A.
'UML' 카테고리의 다른 글
아이템설계 (0) | 2017.04.13 |
---|---|
UML Class Diagram Relationships, Aggregation, Composition (0) | 2016.10.13 |
UML설계 (0) | 2016.10.12 |
UML - 기본편 ( 기본 표기 형식 및 관계 표현법 ) (0) | 2014.03.25 |
UML 클래스 다이어그램 기본상식 ( C# ) (4) | 2014.02.05 |