Implement an interactive CLI class with tests

Quick 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.

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.

Quick Answer: 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.

|Home/Coding & Algorithms/Shopify
Shopify logo
Shopify
Aug 13, 2025, 12:00 AM
mediumMachine Learning EngineerOnsiteCoding & Algorithms
12
0

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.

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...