Step 1. Define all Actions: - Drop Cup, - Feed Hot Water, - Add Milk - Add Sugar. For these, make a dedicated routine or AddOnInstruction. If you think is too simple and not necessary, just think that you will have to write a diagnostics for each, and maybe you are gonna reuse Drop Cup in another project. What happens if you Drop Cup, and you are out of cups, or dropping device is defective, and so on?
Step 2. Now that you have isolated these, make the graph as everything is needed, even if not.
Step 3. Create recipe format, putting parameters for Ingredients - for Add Milk, put as parameters: requiredOrNot, numberOfSeconds
Step 4. Create as many recipes as you wish. You will never modify the software based on recipe.
Step 5. Create a recipe management. This will be very useful for all your future projects. It’s a one time task.
This is how I made a cocktail bar for my wedding. I gave to my friends about 20 recipes, and by the end of the day, I found about 50 in recipe list.
P.S. I know that seems too complicated for given task, but if you step away from your particular task and analyze my example, you’ll realize that you can write any program without reinventing the wheel every time.
I would also recommend creating steps so that things don’t happen at unexpected times. Here is how I would set it up (Note: I wrote this very quickly, buyer beware)