Implement an interactive CLI class with tests
Company: Shopify
Role: Machine Learning Engineer
Category: Coding & Algorithms
Difficulty: medium
Interview Round: Onsite
Design and implement a command-line interactive application as a single class using OOP principles. The program should support commands: add <key> <value>, get <key>, delete <key>, list, help, and exit; persist state to a local file; validate and handle invalid input gracefully; log errors; and be easily extensible for new commands. Write comprehensive unit tests that cover happy paths, edge cases (e.g., duplicate keys, missing keys, malformed commands), and error handling. Include a README with local setup instructions, how to run tests, and a GitHub workflow (e.g., Actions) that runs the test suite on push. Explain your class design (state, methods, dependency boundaries), how you would refactor to support subcommands/modules, and trade-offs you made under a 60-minute time constraint.
Overview: This question evaluates object-oriented design, command-line interface implementation, persistent state management, input validation and error logging, extensibility for new commands, comprehensive unit testing, and continuous integration configuration.
Read the full Shopify Machine Learning Engineer interview experience this question came from