• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question on class identification.

 
Merlin M Koppula
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Merlin M Koppula
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is the exhibit..
 
Pho Tek
Ranch Hand
Posts: 782
Chrome Python Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Merlin M Koppula
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Pho Tek
Ranch Hand
Posts: 782
Chrome Python Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Christel Veltrup
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is b) given that there may not be
a PreferredSupplier for every InventoryProduct.
 
Mukesh Joshi
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
nextDeliveryFor is an operation defined
on Supplier. Hence b should work for either objects (possibly through dynamic binding).
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic