aspose file tools*
The moose likes OO, Patterns, UML and Refactoring and the fly likes Question on class identification. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "Question on class identification." Watch "Question on class identification." New topic
Author

Question on class identification.

Merlin M Koppula
Ranch Hand

Joined: Jan 18, 2002
Posts: 69
Hi,
Can can someone please comment on my answer for the following question from mock exam?
Refer to the exhibits to answer the question. What are the names of missing classes XXX and YYY in exhibit below ? (choose one)
a) XXX = DeliverySchedule, YYY = Supplier
b) XXX = Supplier, YYY = DeliverySchedule
c) XXX = PreferredSupplier, YYY = DeliverySchedule
d) XXX = DeliverySchedule, XXX = PreferredSupplier
I chose the answer (b), but I have some doubts that (c) could be correct too. Please let me know your choice on this one and any reasons that you could offer.


MM Koppula<br />SCJP2<br />Object Oriented Analysis and Design with UML (IBM)
Merlin M Koppula
Ranch Hand

Joined: Jan 18, 2002
Posts: 69
Here is the exhibit..
Pho Tek
Ranch Hand

Joined: Nov 05, 2000
Posts: 761

I believe it's (c).
The reason:
Every product item can be fulfilled by several Suppliers depending on location. This is from the assoc.

We also know that every product can be fulfilled by at most one supplier.
(b) only works if there's a one supplier per product. Undoubtedly for the case where there's more than one supplier; you need some differentiation on who is selected.


Regards,

Pho
Merlin M Koppula
Ranch Hand

Joined: Jan 18, 2002
Posts: 69
Pho,
Your logic makes sense.
I guess we have to assume that there is always going to be a preffered supplier from the list of suppliers for a location. So, the nextDeliveryFor() message is never sent directly to Supplier object.
Thank you very much.
Joe Wang
Greenhorn

Joined: Feb 17, 2002
Posts: 6
I would put in Supplier the general class. What if there are more than one subclass of Supplier in the diagram? so I have to vote for the base class.
Thanks.


MCSD,SCJP,SCWCD,486...over certified.
Pho Tek
Ranch Hand

Joined: Nov 05, 2000
Posts: 761

TelusJoe,
You raised an important point.
In the generalization from Supplier to PreferredSupplier, there are no multiplicity indicators. Can you attach (in UML) a multiplicity indicator to generalizations ?
What does the non-existence of such indicators mean ?

Pho
[ February 18, 2002: Message edited by: Pho Tek ]
Mukesh Joshi
Greenhorn

Joined: Feb 05, 2002
Posts: 16
I would vote for Preferred Supplier instead of Supplier since there is a possibility that the Supplier class is abstract and one cannot instantiate abstract classes. On interaction diagrams one would normally expect to see only instantiated objects.
Am I right ? Makes sense but I am not sure.


Mukesh
Christel Veltrup
Greenhorn

Joined: Feb 20, 2002
Posts: 3
I believe the correct answer for this question is (b) Supplier.
Supplier is not an abstract class, not in this diagram so the object in the sequence diagram may be both, Supplier OR PreferredSupplier.
From the diagram we can't conclude that each Supplier has to be a PreferredSupplier, only the opposite way, so putting in Supplier is correct for every concrete Supplier-Object.

And, about multiplicity of generalizations, I'm pretty sure that you can't do something like that in UML.
Multiplicity belongs to assoziations, it tells something like Class A has/knows one or many B's. How could you read this for a generalization? Class A is many B's? Makes not much sense to me.
Chris
Mukesh Joshi
Greenhorn

Joined: Feb 05, 2002
Posts: 16
Good point but ...
The relationship between InventoryProduct and Supplier is many-to-many. This means that the InventoryProduct object has to select a Supplier from a list of suppliers before it can send any message to it. How would the InventoryProduct object identify its supplier ?
But if we assume that the InventoryProduct somehow knows its preferred supplier then it can directly send a message without going through a selection process.
Leander Seth
Greenhorn

Joined: Feb 26, 2002
Posts: 5
It is b) given that there may not be
a PreferredSupplier for every InventoryProduct.
Mukesh Joshi
Greenhorn

Joined: Feb 05, 2002
Posts: 16
If you didn't have a preferred supplier how would the anInventoryProduct select "the" supplier from a list of many suppliers ?
Since the diagram does not indicate selection of a specific supplier from the list of suppliers I still think that the answer is C.
Leander Seth
Greenhorn

Joined: Feb 26, 2002
Posts: 5
nextDeliveryFor is an operation defined
on Supplier. Hence b should work for either objects (possibly through dynamic binding).
 
Consider Paul's rocket mass heater.
 
subject: Question on class identification.