1

I am trying to design a restaurant ordering system in UML, which should also include the stock system.

One of the classes is a Dish (i.e. a dish on the menu), and another is an Ingredient.

My initial idea was to place an aggregation of Ingredients within Dish, but I've also read that a many to many relationship is more appropriate.

My problem is that in this case, simply having a relationship isn't enough. For instance a Dish could have 30g of Ingredient A, while another Dish could have 20g of Ingredient A.

How can I model this kind of dependency in UML?

1
  • Er ... perhaps my assignment requires me to ...? This is a standard class assignment requiring you to connect the requirements with a typical Bill Of Materials solution.
    – andy256
    Nov 24, 2014 at 4:30

2 Answers 2

1

Create a Many to Many relationship; call it DishIngredients.

Include Amount and Units fields in DishIngredients; this will let you specify the amount (e.g. 30) and units (e.g. grams) for each Dish/Ingredient combination.

0

An Ingredient is a Product in a Recipe (or Dish) with it's Quantity (quantity should include Unit of Measure and be translatable between units). A Recipe contains many Ingredients. A Product can be in many Ingredients. And can be in Stock with a Quantity as well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.