← Zip Interview Insights

Zip·Software Engineer·Technical Phone Screen·Intermediate

IntermediatePrefer not to say
Apr 2026Remote

Summary

Ziphq software engineer round focused entirely on OOD, specifically designing a vending machine from scratch with starter code provided. You had to write your own tests, which I wasn't fully prepared for.

Questions Asked (1)

Q1

Design a vending machine in an object-oriented style. Define the core classes and interfaces covering product inventory, balance accumulation from inserted bills and coins, and change-making on purchase completion. Starter code is given; you are expected to write your own tests.

System DesignData ModelingTechnical Trade-offs
Author's notes

I spent way too long on the Product class and not enough time thinking about how the balance and change logic would interact.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and constraints (e.g., accepted denominations, change availability, concurrency). Then sketch the core classes and interfaces, focusing on separation of concerns: inventory, payment, and change-making. Finally, discuss trade-offs and how you would test each component.

Pro tip: Mention that you would inject a change-making strategy (e.g., greedy vs. optimal) to make the system extensible and testable. Also, highlight the importance of handling edge cases like insufficient change or invalid coin insertion.

1. Clarify Requirements

Ask about accepted payment types, product types, change-making constraints, and concurrency expectations. Confirm whether the machine must handle exact change only or provide change from a reserve.

2. Identify Core Classes

Define classes like VendingMachine, Inventory, Product, PaymentProcessor, and ChangeMaker. Specify interfaces for payment and change-making to allow different implementations.

3. Design Interactions

Outline how a purchase flows: select product, insert money, validate balance, dispense product, and return change. Ensure each step is handled by the appropriate class.

4. Address Edge Cases and Trade-offs

Discuss handling of insufficient funds, sold-out products, inability to make change, and concurrent access. Compare strategies for change-making (greedy vs. dynamic programming).

5. Plan Testing

Describe unit tests for each component: inventory updates, balance accumulation, change calculation, and end-to-end purchase scenarios. Mention mocking dependencies for isolation.

Key Points to Mention

  • Separation of concerns: inventory, payment, and change-making as distinct responsibilities.
  • Use of interfaces (e.g., PaymentMethod, ChangeStrategy) for extensibility and testability.
  • Handling of edge cases: insufficient funds, sold-out items, exact change availability, and invalid inputs.
  • Concurrency considerations: thread safety for simultaneous purchases or refills.
  • Trade-offs in change-making algorithms: greedy vs. optimal, and their implications.
  • Importance of writing tests: unit tests for individual classes and integration tests for purchase flow.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.