aspose file tools*
The moose likes Architect Certification (SCEA/OCMJEA) and the fly likes Doubt about class diagram - Part 2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Architect Certification (SCEA/OCMJEA)
Bookmark "Doubt about class diagram - Part 2" Watch "Doubt about class diagram - Part 2" New topic
Author

Doubt about class diagram - Part 2

Eduardo Rodrigues
Ranch Hand

Joined: Jul 01, 2003
Posts: 199
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<br />SCJP 1.4/5.0 SCWCD 1.3/1.4, SCBCD 1.3, SCMAD, SCEA<br />IBM 484 & 486<br />Belo Horizonte<br />Minas Gerais<br />Brasil
Eduardo Rodrigues
Ranch Hand

Joined: Jul 01, 2003
Posts: 199
Nobody???
Please, help me!
Best regards,
John Hartnet
Greenhorn

Joined: Apr 26, 2004
Posts: 2
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.
Ajith Kallambella
Sheriff

Joined: Mar 17, 2000
Posts: 5782
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,


    Open Group Certified Distinguished IT Architect. Open Group Certified Master IT Architect. Sun Certified Architect (SCEA).
    Eduardo Rodrigues
    Ranch Hand

    Joined: Jul 01, 2003
    Posts: 199
    Thank you so much, your reply is always very helpful!
    Best regards,
    Harish Ramchandani
    Ranch Hand

    Joined: Mar 18, 2004
    Posts: 65
    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

    Joined: Jul 01, 2003
    Posts: 199
    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!!!
    Jacky Doner
    Ranch Hand

    Joined: Dec 02, 2003
    Posts: 53
    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.
    Siddhartha Bhattacharya
    Ranch Hand

    Joined: Jul 02, 2002
    Posts: 36
    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.
    K Huang
    Ranch Hand

    Joined: Dec 12, 2002
    Posts: 55
    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

    Joined: Dec 02, 2003
    Posts: 53
    Hi Jim,
    According to your post,how to change segment in change itinerary use case,for the flight is same.
    Ajith Kallambella
    Sheriff

    Joined: Mar 17, 2000
    Posts: 5782
    Guys,
    You are getting into all the details of the assignment here which is against the policy we have adopted.
    Eduardo Rodrigues
    Ranch Hand

    Joined: Jul 01, 2003
    Posts: 199
    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!
     
    It is sorta covered in the JavaRanch Style Guide.
     
    subject: Doubt about class diagram - Part 2