This updated information has been further expanded upon on my new website. You can find the updated details here: https://k5kc.com/cs/ood/design-a-vending-machine-like-coffee-vending-machine/.
Broadly, think about what objects are involved in a vending machine:- VendingMachine - possibly an abstract class
- DrinkMachine, SnackMachine, and classes extending VendingMachine
- VendingProduct - an abstract class?
- Drink, other classes extending VendingProduct
- Coke, other classes extending Drink
- &c, &c.
Also, Getting the coffee will be got from the factory:
public class CoffeeVendingMachine extends VendingMachine{ private Milk milk; private Sugar sugar; public Coffee getCoffee(CoffeeTypeEnum coffeeType){ prepareCoffee(coffeeType); } private void prepareCoffee(CoffeeTypeEnum coffeeType{ //internal process for coffee making } }
Note that prepareCoffee is private method, as users don't want to know how coffee is made.
Here is the basic class diagram for vending machine(borrowed from programsfromca):
Note that VendingMachine composes SelectionPanel, Controller, Product and so on.
References
How is the above UML going to look like when coded using CLIPS?
ReplyDeletehey, I havent coded in CLIPS...(apologies for such a late response). I have updated the content here: https://k5kc.com/cs/ood/design-a-vending-machine-like-coffee-vending-machine/ and I am using mermaid to draw the diagram.
Delete