Index

Free, with Google

Keep going, free.

A free account opens lessons 2 and 3 of every track, 33 more lessons, and keeps your progress and review cards on every device.

Start free with Google

Launch price

Open everything on chalk.

Every lesson, board, video, lab and paper, and the full review decks. Yearly is $39/year, or $19.50 for your first year with LAUNCH50, ends 1 Nov, 18:30 UTC.

See plansStart free instead

Module 10 · System Design · Six more low-level rounds

Design a vending machine (states that refuse)

Design a Vending Machine
Design a Vending Machine · Open board

The four states and the buttons each refuses, money in whole paise, the change that greedy cannot make, and the operator mid-sale.

Before you start. You need two lessons. Tell everyone who cares (Observer and State) taught the state pattern: an object hands every action to a small class standing for the situation it is in right now, and that class either does the action and swaps in the next situation, or refuses with an error. A missing arrow in the drawing is a refused action. Design a parking lot (the first whole round) ran a whole interview round in order: ask questions, find the entities, sketch the classes, code the one tricky part, take the follow-up. This lesson runs the same round on a machine whose whole personality is saying no.

Lesson 46 of 73 in System Design

The rest of this lesson is part of a plan.

A plan opens every lesson, board, video, lab and paper on chalk. Yearly is $39/year, or $19.50 for your first year with LAUNCH50, ends 1 Nov, 18:30 UTC.

See plansAlready a member? Sign in

Or start free: a free account opens lessons 2 and 3 of every track.

In this lesson

  • 1883: a machine that sells a postcard and trusts nobody
  • Step one: ask before you draw
  • State and transition: what the machine remembers
  • Inventory and the money that must be whole numbers
  • Change-making: the part that can fail
  • Refund: the tray is not the bank
  • The follow-up: an operator opens the door

Terms it explains: state pattern, state, tray, transition, inventory, change-making, bank, refunds, payment, refund.

Review System Design