Index

Steps


We're going to (code) a simple "drink machine".

The components are shown in this sketch.
The machine will dispense a great variety of different drink types. Here is just a partial list:
  • Water
  • CarrotOrangeJuice
  • CarrotAppleJuice
  • CarrotAppleJuice
  • WatermelonAppleJuice
  • KaleCarrotJuice
  • KaleAppleCarrotJuice
  • SpinachCucumberSmoothie

We generally call any of these types a "Drinkable"
Time to take a cut at an object
diagram.

We try to have the object diagram model (mimic) the real world or domain.

So we browse over our sketches again.
Here is an object diagram template.

The three ivars shown are just for the template.

We may have anywhere between zero to many ivars.
DrinkMachine
    ---- ivar1 -------- ivar1Type
    ---- ivar2 -------- ivar2Type
    ---- ivar3 -------- ivar3Type
   etc

Come up with your first try of an object diagram
DrinkMachine
    ---- ivar1 -------- ivar1Type
    ---- ivar2 -------- ivar2Type
    ---- ivar3 -------- ivar3Type
   etc




Conclusion


What things did we learn about coming up with object ideas?