I am trying to find an elegant way to implement a decision-making algorithm that makes it easy to maintain, because the conditions for making decisions can often change.
I will try to clarify an example:
Let's say I'm trying to manage a team of chefs in a restaurant kitchen.
Each chef knows how to cook 3 types of pies: apple pie, pumpkin pie and raspberry pie and 2 types of pizza: cheese pizza and bacon pizza. They all know how to cook everything.
Now I would like to send orders to these bosses regarding what will come for clients.
Conditions:
The manager can only cook one pie at a time. If I order a chef to make an apple pie, for example, I cannot order him to make a raspberry pie or pumpkin pie if the apple pie is not made, or I sent a request to cancel the apple pie.
I can ask the chef to cook up to 5 pizzas at the same time, considering it for different customers.
I would like to create an algorithm that returns a set of orders that I am allowed to send to a particular chef regarding what he is already preparing.
I am working with C ++. I could write a simple switch / case statement, but maintenance would not be easy if the conditions changed or new cakes were added, and therefore ...
, , .
?