File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Architect Certification (SCEA/OCMJEA) and the fly likes Flight that span multiple segments Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Architect Certification (SCEA/OCMJEA)
Bookmark "Flight that span multiple segments" Watch "Flight that span multiple segments" New topic
Author

Flight that span multiple segments

Rishi Krishnan
Greenhorn

Joined: Jun 08, 2006
Posts: 28
How did you handle the case where in a flight spans multiple segments(Direct flight with multiple stops)?

Here the 1-1 bi-directional relationship is violated. Multiple segments will refer to 1 flight. But 1 segment always refers to 1 flight

Any Thoughts?
Morten Franorge
Ranch Hand

Joined: Jul 29, 2005
Posts: 137
I believe the travel industry uses the term Segment in the same way that the retail industry uses "order line", flight (or hotel reservation) being the product.. I hva chosen to include a "route" object/table in my design to facilitate the stop-over flights.. No guarantees as I'm yet to submit my assignment


SCJP 1.4, SCBCD 1.3, SCBCD 5.0, SCEA J2EE, SCEA 5.0
Rishi Krishnan
Greenhorn

Joined: Jun 08, 2006
Posts: 28
Hi Morten,

Thanks for the reply.

How did you achieve the 1-1 bidirectional relationship by introducing the Route Object? Infact I am not sure about the purpose of this Route Object. The user is going to see segments and select seats by segments. My UI will show available seats for all segments in the Itinerary(both one-way and round-trip) in a single screen. So it is up to the user to choose the same seat if available or choose different seats. What is your thought on this?

Actually after thinking about the segment-flight relationship for 2 days, I have decided to add an assumption that "A flight cannot span segments". Afterall the BDM says it is not.

Thanks
Rishi
Morten Franorge
Ranch Hand

Joined: Jul 29, 2005
Posts: 137
My definition of flight is one that takes off once, and lands once.

The route object is there to "know" about the combination of flights that will take you from A to Z. For each flight there is one segment. An iteniary consists of many segments.
Rishi Krishnan
Greenhorn

Joined: Jun 08, 2006
Posts: 28
I completely agree with your definitions about Segment, flight and Route. (Only I defined Route object as Trip object).

But I am not sure if I need Route table. In real world there are various algorithms that can be used to aggregate segments for a selected route. I think this should be done dynamically. If we do this math and store all possible combination of routes in a database table, I am not sure how many thousands/millions of records we might have to store for the entire United States.

So I am assuming that my DAO will take care of this implementation detail.
Morten Franorge
Ranch Hand

Joined: Jul 29, 2005
Posts: 137
Originally posted by Rishi Krishnan:
I am not sure how many thousands/millions of records we might have to store for the entire United States.


That's exactly why I feel the need for a table to store the alternatives. There are two reasons for this.

The algorithme would produce the thousands/millions of alternatives that you mention, making it a performance issue...

The algorithme would probably find a route from LA to SF via NY. That shouldn't be possible...

All IMHO of course...as long as you put it in your assumptions I think you should be ok..
Rishi Krishnan
Greenhorn

Joined: Jun 08, 2006
Posts: 28
I think you've got me wrong. I suggest you google for these algorithms and have a look at them. They will have answers for both of your reasons.
Meghana Reddy
Ranch Hand

Joined: Jan 29, 2002
Posts: 76
Do we need to design the DB tables as well?

Is that for our internal purpose, or do we need to show the database model as well in the documentation?

I am currently doing the assignment.

Thanks


Meghana Reddy
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Flight that span multiple segments
 
Similar Threads
Cleared Part II and III with 83%
Some do's & don'ts
Equipment question
Route - Flight - Segment again.
BDM - cardinality of Flight - Segment relationship