Hi I m trying to find relationship between classes in my program , I am not sure enough that i am right, do you have any ideas what relationships should be between the classes, thanks.
Do you mean UML Association ?
or what relationships are we talking about ?
Like when to use Association versus Aggregation ?
Well Association is the most used but it depends on how they exists and how they are really connected.
if B is part of A it would be aggregation/composition.
that is more of an Association than aggregation.
A train is not really made up of train_stops so its not a aggregation as such.
Well most of the time UML diagrams tries to describe/model the reality and not the implementation.
the type of association from the real life.
You then choose to implement it with a vector but that an implementation detail.
in different ways depending on the need of the program.
We have a room class and a house class.
We model the it as the house have 1 or more rooms and a room can be in exactly one house.
as a Composition. As in the real world room does not exists without a house.
so in the programs the house just have a list of rooms that points to a list with available rooms.
So here the implementation, its actually implemented as a association/aggregation.
So what to use depends on what type of Diagram you are trying to make.
Does it describe the real life world or does it describe implementation details ?
@mrjj So I tend to think that arrival_city and available_rotes has relationship composition although arrival_city could exist like city without depart city(from) in available_routes, but route itself could not exist without arrival city is it good idea?
And should i think so(composition) about available_routes in passenger_train?
it has no cites and hence aggregation/composition seems very valid.
object is very tied to the owning class and would not exits on its own.
that my route depend on whether the train exist so it is possible to be composition?
Yes then the actual implementation will use composition and its up to show what you want to show on the diagram.