• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

How is the segment implemented ?

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
I'm writing my assignment for part II. I have come across the definition of Segment. I understand that a Segment has a 1 to 1 relation to a Flight, but how do you implement it in practice ?
Is it implemented by a plain JavaBean which holds information about the flight ? in other words when the client looks for a flight, system returns an Enumeration of Segment....

is it right ?
thank you
rol.
 
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


when the client looks for a flight, system returns an Enumeration of Segment



you have said that the relationship between fligh and segment is one to one. why does it return an enumeration of segment after searching a flight? i think you still need to make clear what the real business meaning about flight and segment. not only their relationship. the problem of flight&segment is a PO topic in ranchers forum. you can use the searching function to find them.
 
Rolando jimenze
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
thanks for your reply.

Well I was meaning that when search is performed, multiple flights are found (for example 5 flights on that day), so a Collection of Segments are returned to the user.

The user select which flight (=Segment) wants to buy. Each flight corresponds to a Segment.

Did I understand correctly the business model ?

Thanks
rol
 
Newman Huang
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
try this:
real life example

yes, it is need to create VO for displaying of search result.
 
author
Posts: 194
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think he asked if the Segment is "mapped" as Value Object, transferred from the system when the search is performed. I have implemented too as value object both from the server side (Collection of VO returned after search) and from the client side (VO chosen in the list of flights).
Anybody wants to join the discussion ?
bye
Francesco
 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How will you know which segments form the departure trip and which ones form the return trip?
 
Ranch Hand
Posts: 166
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Newman Huang

Thank you so much for providing the real life example.
It really helps me understand how to book tickets in real life.
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
here is my understanding...

An Itinerary must have at least 1 segment (Min. one-way i.e. a direct flight (can have more than one segment if not a direct flight))

Itinerary: includes everything from start to end.

When the user does a search; the search result could be a Collection of Itinerary objects each associated with a segment or collection of segments;

Round Trip:
Each Itinerary will have information about onward (could have > 1 segments) and return trip (could have >1 segments), [how this is generated i.e. different combinations depends on business logic]
To figure out the return flight you can maybe check the Airport codes (against the user input) and also possibly the Dates.

Let me know if anyone has any other ideas...
thanks
sai
 
Steve Taiwan
Ranch Hand
Posts: 166
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My class diagram and sequence diagrams are exactly the same as what sai explained.

Regarding the VO and TO, in my class diagram and sequence diagrams, Itinerary, Segment and Flight are all VO.
And I am also thinking whether I shall have ItineraryUtil to contain some business logic, like 'calculation of total price'.
However, another way to do something like calculation of total price is to put the calculation algorithm in ItineraryVO because
ItineraryVO is the knowledge export who knows all prices. Doing this might make ItineraryVO unlike VO.
I don't make my mide yet.
 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sai,
I've been considering same approach as you. The search API returns a collection of itineraries. Assuming it's 2 way trip, user selects 2 of these. After final confirmation, these 2 itineraries will then be assembled into an itinerary attached to customer and possibly persisted?
At this phase of design I'm not involving any technical details such as TO or VO...

thanks,
Andrew
 
Andrew Zilahi
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also, using Itinerary as the search result has an issue, unless you change the BDM: itineraries returned by search *must* have at least 1 seat attached (acording to cardinality Equippment - Seats).
I interpret the "Seats" object in the BDM as the seats booked as part of prepare itinerary use case.

Am I missing something?

Thanks!
Andrew

ps
the plural in "Seats" also doesn't make sense...
 
Steve Taiwan
Ranch Hand
Posts: 166
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Andrew Zilahi

In my design,
An ItineraryVO could have many segments to complete a round trip.

Segment Class has 2 special attributes for GUI layout control, groupId and sequenceId. GroupId attribute means these segments with the same groupId must be combined to become a complete short distance trip. SequenceId attribute means these segment swith the same groupId should be displayed in the order which is indicated by sequenceId.
Another attribute, isReturn, indicates that this segment is for departure or for return trip.

Here is the example of segments in an Itinerary for a round trip.
groupid sequenceId isReturn departure destination
segment1 1 1 N Taipei Hawaii
segment2 1 2 N Hawaii New York
segment3 2 1 N Taipei Hong Kong
segment4 2 2 N Hong Kong New York
segment5 3 1 Y New York Detroit
segment6 3 2 Y Detroit Taipei

Help?

[ October 23, 2006: Message edited by: Steve Taiwan ]
[ October 23, 2006: Message edited by: Steve Taiwan ]
 
Andrew Zilahi
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Steve,
This is great. I just have a couple commebts though:
1.Segment belongs to the BDM, and hence should have no attributes/methods that are technology/GUI specific; you could wrap it though in a VO...
2. Segment mandates the existence of at least 1 seat, according to the BDM diagram. How would you handle it? There are no Seats assigned to your customer at the time the first search returns the result?

Thank you,
Andrew
 
Steve Taiwan
Ranch Hand
Posts: 166
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Andrew.

According to the BDM, Segment has Flight, Flight has Equipment, Equipment has Seat
so Seat can be associated with Segment. Also Itinerary has many Segments so an Itinerary can
have many Seats without doubt. My Seat has some interesting attributes, like location, customerId, status.
Location, such as J22, is the exact loction in an Equipment. CustomerId is for query purpose and makes Seat
associated with Customer directly. Status means whether the specific Seat is available, occupied or something else.

At the first search, no Seat will be assigned to the Customer who makes the query.
 
Andrew Zilahi
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Steve,
You just mentioned that initially you don't assign any seats as a result of the search. This is not possible due to cardinality (Equipment mandates it).
Also, you shouldn't have to add Customer attribute to seat, as Customer will be associated with Itinerary directly, and hence you hane the relationship from there.
I am considering using custom request/result objects for the search to keep the model clean.

thanks,
Andrew
[ October 24, 2006: Message edited by: Andrew Zilahi ]
 
Steve Taiwan
Ranch Hand
Posts: 166
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Andrew.

In prepare itinerary, customer selects seats in step 7 but not in the first query.

If Seat doesn't have customerId, how do you know the relationship between Customer and Seat?
The requirement said RDBMS will be used. So when you do OR mapping, you should have a attribute in Seat to indicate that
the specific seat number is occupied by the specific customer. Otherwise, I don't know how to retrieve the data from DB to Seats in doing OR mapping.
 
Andrew Zilahi
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Steve,
In this phase, you should *not* be concerned about the technologies used for the implementation (i.e. RDBMS, J2EE, etc). You just want to create a clean domain model first. Once this is done, you can think about how to wrap and persist these objects, as well as how to render them.
To answer your question, as long as Itinerary object is connected to customer, your relationship is right there.

I'm still puzzled about the best approach for returning the search results, so I am going to post a new topic for this.

rgds,
Andrew
 
Yeah, but is it art? What do you think tiny ad?
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic