• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Doubt about class diagram - Part 2

 
Ranch Hand
Posts: 199
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys...
I'm with difficulties to complete my class diagram:
1 - In the SCEA Study Guide by M. Cade and S. Roberts they include in the class diagram some stateless ejb's and some new classes.
My doubt: some of the business class could be implemented by entity ejb's... Must I include the <<EntityBean>> stereotype on the diagram, for example <<EntityBean>>Customer???
2 - For the already SCEA: I'm a bit confused by the relationship 1-1 between Segment and Flight? Can you give some tips?
3 - Can I add some entity like CreditCard ???
4 - What about represent two generalizations of Seat named CoachSeat and FirstClassSeat??? And about a generalization of Itinerary named PaidItinerary???
Thank you so much!
[ April 24, 2004: Message edited by: Eduardo Rodrigues ]
 
Eduardo Rodrigues
Ranch Hand
Posts: 199
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nobody???
Please, help me!
Best regards,
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1 - In the SCEA Study Guide by M. Cade and S. Roberts they include in the class diagram some stateless ejb's and some new classes.
My doubt: some of the business class could be implemented by entity ejb's... Must I include the <<EntityBean>> stereotype on the diagram, for example <<EntityBean>>Customer???

>> I think that shouldnt be a problem.
2 - For the already SCEA: I'm a bit confused by the relationship 1-1 between Segment and Flight? Can you give some tips?

>> Consider Segment as a leg of journey which has a leg no, connection indicator and a flight no + other stuff
So your PHL HNL could have 2 segments
Segment 1
leg no 00
connection indictor Y
flight no Flight->flight no
dest LAX
gateway PHL

Segment 2
leg no 01
connection indictor N
flight no Flight->flight no
dest HNL
gateway LAX
So the smallest denomination is a segment which has exactly one flight associated. Both the segments together will form 1 option.

3 - Can I add some entity like CreditCard ???
>>Sure
4 - What about represent two generalizations of Seat named CoachSeat and FirstClassSeat??? And about a generalization of Itinerary named PaidItinerary???
>> Not needed i think.
 
Sheriff
Posts: 5782
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Eduardo Rodrigues:
4 - What about represent two generalizations of Seat named CoachSeat and FirstClassSeat??? And about a generalization of Itinerary named PaidItinerary???


This is where you have to apply your OO skills. Give it some thought. Generalizations/Specializations normally result in "types". The applicability of such types depends entirely on the perceived property(attribute) that acts as the conceptual divide. Trying to identify generalizations too soon in the process often results in unusable/vague type hierarchies. It may also result in a wrong property(attribute) acting as the pivot for your hierarchies.
For instance, consider an "automotive" application domain. You have Cars and SUVs, each can have either a 2WD or a 4WD. Each can come with a Passenger or a Sport flavor with either a 2Door or a 4Door. I can think of several ways to generalize the entities in the domain -
  • Car and SUV at the top of type hierarchy.
  • 2WD and 4WD at the top of type hierarchy.
  • Passenger and Sport at the top of type hierarchy.


  • Without knowing anything about how these entities interact, it is hard to determine what is the best type hierarchy. Also note that any pivotal parameter used as the conceptual divide for type hierarchy( Sport/Passenger, Car/SUV, 2WD/4WD, 2Door/4Door ) can also be represented as a plain attribute. The best decomposition is one that results in unambiguous types with each type being able to describe and collaborate with other types/application components.
    Now coming back to your original problem(finally) - "What about represent two generalizations of Seat named CoachSeat and FirstClassSeat??? And about a generalization of Itinerary named PaidItinerary???",
    Ask yourself these questions -
  • What do you gain by such a generalization ?
  • Can you not model a Seat entity with an attribute for class(coach/first) and a boolean attribute isPaid ?
  • What other domain entities interact with your newly created types? What will be the effect of introducing types( result of generalizations) on these interactions?

  • Lastly, consider creating generalizations as a refactoring excercise instead of an early-on OO ritual. If you want to learn more, Google around for "dependency inversion principle" and "refactoring". If you have a few bucks to spare, I recommend reading "Object Oriented Software Construction" by Bertrand Meyer.
    Hope that helps,
     
    Eduardo Rodrigues
    Ranch Hand
    Posts: 199
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Thank you so much, your reply is always very helpful!
    Best regards,
     
    Ranch Hand
    Posts: 65
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Hi Ajith,
    Should we use technology related classes e.g. Entity Beans and Stateless Session Beans in Class Diagrams? I read in some threads to use generic classes that are related to business domain?
    Any suggestions ?
     
    Eduardo Rodrigues
    Ranch Hand
    Posts: 199
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Originally posted by John Hartnet:

    So the smallest denomination is a segment which has exactly one flight associated. Both the segments together will form 1 option.
    [/QB]


    Hi again!
    I'm having problems with this instant view of the system...
    I was thinking in make the "Segment" class have three atributtes:
    - departureCity(String) , destinationCity(String) and flatPrice(float)
    So I would break the relationship between Segment and Itinerary, and then make the relationship between Segment and Flight be 1 - 1..* . I want to say :" a segment can be covered by many flights"... Then I will add four attributes to the "Flight" class:
    - departureDate
    - departureTime
    - arriveDate
    - arriveTime
    So the relationship between Flight and Segments will means :" A segment can be covered by many flights in different dates and time"...
    Then I will make a "Reservation" class that will have a relation to "Itinerary" in the way that a Itinerary will have one or more Reservation. A Reservation will have a relationship with "Flight" and "Seat", in this way:
    Reservation 1..* --- 1 Itinerary
    Reservation 0..* --- 1 Flight
    Reservation 0..1 --- 1 Seat
    I think my approach is perfectly valid, but I want some opinions/suggestions...
    May I'm wrong???
    My head will blow up! I'm crazy about this diagram...
    Ranchers, please help me!!!
     
    Ranch Hand
    Posts: 53
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Hi Eduardo,
    As for the part relationship of objects design you provided,I couldn't
    find out what's the relationship between Itinerary and segment.It's obviously that Itinerary could have at least one segment,and as your assumption,a segment could have many flights,although we could also assume
    that for the specified segment there is only one flight (flight number and aircraft is same,but could have different take off time).
    In your design,I also don't know the role(attribute)of the reservation object plays,and the relationship between aircraft(equipment) and flight,seat.
     
    Ranch Hand
    Posts: 36
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    The relationships provided between Itinerary Segment Flight in the specification seems right. If you follow this the rest of the stuff should fall in place.
     
    Ranch Hand
    Posts: 55
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    I think a segment is a part of a flight.
    For example, a flight may make several stops between its origin and destination, keep the same flight number. Each stop makes a segment.
    Am I right ?
     
    Jacky Doner
    Ranch Hand
    Posts: 53
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Hi Jim,
    According to your post,how to change segment in change itinerary use case,for the flight is same.
     
    Ajith Kallambella
    Sheriff
    Posts: 5782
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Guys,
    You are getting into all the details of the assignment here which is against the policy we have adopted.
     
    Eduardo Rodrigues
    Ranch Hand
    Posts: 199
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Hi Ajith.
    Sorry I didn't saw the old post early...
    But I think that this level of detail is ok, not???
    Because I am showing only a small part of my thinks (and not my solution, in fact my solution is very different)...
    But I understand your position and I will try to police me...
    If you want you can delete this topic...
    Thank you again!
     
    reply
      Bookmark Topic Watch Topic
    • New Topic