Let's say I have to model the meals of a diner.
A meal can consist of several "components":
- (Fries OR rice OR wedges)
- AND (One of six different beverages)
- AND (One or two out of seven different sauces OR none at all)
Another meal can consist of:
- (Salad OR rice)
- AND (Garlic OR no garlic)
Further meals can consist of:
Just fries
Just a beverage
Just ...
How can I model this? (UML, entity-relationship, code, ... whatever you can explain best)
Perhaps it helps if you know some tasks I want to perform, so:
- Allowing the customer to choose a meal first and display all remaining "add-ons".
- Detecting a meal from a list of components. For example if the customer ordered fries, a sauce and a beverage, it should be possible to detect the meal from the first example.
I've thought about dividing all components into articles and then adding some kind of role mapping to mark "fries" as supplement to "cheeseburger", "schnitzel", "..." but then I wondered, how I could model multiple add-ons, optional add-ons, n-out-of-m add-ons...
I hope you can help me out...