Skip to content

Vending Machine — Notes#

Functional#

  • Browse items, select.
  • Accept cash or card / UPI.
  • Make change.
  • Dispense item.
  • Refund on cancel.

Non-functional#

  • Reliable state transitions; never charge without dispense.
  • Refill / maintenance mode.

Patterns#

  • State, Strategy (payment), Singleton (machine), Observer (low stock).

Trade-offs#

  • Multiple payment methods complicate state; isolate per PaymentMethod.
  • No change available → reject coin or reduce options.

Refs#

  • Common LLD references (Grokking OOD).