Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ClassDiagram - Itinerary and Segment

 
dag nattland
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which data should be stored in an Itinerary and which data is stored in Segment?

I am creating my class diagram from the given scenario:
Customer: Dag itinerary: Oslo - Bergen, departure_date: 22/12:1200, flight_#: 123, seat d3

Customer: Dag itinerary: Bergen - Oslo, departure_date: 24/12:0900, flight_#: 321, seat f4

So it is a round-trip oslo-bergen.

I would like to store id(pk):1, departure_time: 22/12:1200, and segment_id: 1 in Itinerary saying which airports to connect.

In Segment I would like to store, segment_id(pk):1, connection_1: Oslo Connection_2: Bergen to say that these two flights are connected.

But this makes the multiplicity between an Itinerary and a Segment - * to 1 as segment_id is a foreign key in Itinerary. You may have many people buying tickets for the same flight. And I havnt touched on the case where there are many segments in an itinerary. So the relationship is * to *. Should there be an OrderItem in between?

How should you persist Itineraries (that are completed) so that the customer knows which flight his taking?

Where do you store departure time?
What is an Itinerary?
 
Jim Janssens
Ranch Hand
Posts: 210
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Besides the fact that this discussion is as old as the assignment itself it seems, I would like to point out that in a class diagram there is nothing wrong with having a many to many relationship. A student may participate in many courses and a course may have many students enrolled. So the class diagram is:

[student]0..* ------ 0..* [courses]

A relational database is not capable of storing this, you need to break a many-to-many down into 2 times a one-to-many relationship by introducing a 3th table: 'student_courses' for example.

But, we are not defining database tables, are we ? Neither are we talking about an ER view of the system. In fact, it might be so that we do not eve know which type of database is going to be used (object, hierarhical, relational...)

So, you do not really want to address this third table as a class. This is a technical detail of the system when you select a relational database. Your technical persistence implementation will make sure that you get students objects pointing to courses and courses pointing to student classes. The fact that you persistence mechanism needed to use a third table to load this information is not relevant for you class diagram (well not at this level anyway).
 
dag nattland
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You say it is age old. So have you got any links to other discussions here that discusses just this? Ive done a search on "Itinerary Segment" but the threads I looked through wasnt very usefull.
 
dag nattland
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
oh! I forgot to say - the link would be usefull if it is in a class diagram context.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic