Design a Simple Task Management Service
Requirements
Design a simple task management system that supports:
-
Add a new task with a unique ID and description.
-
Mark a task as completed by ID.
-
Get all incomplete tasks.
-
Get all completed tasks.
-
Get a task by ID.
What to Deliver
-
Data model (entities, fields, and indexes).
-
Core APIs/classes (language-agnostic or your preferred language).
-
Choose in-memory vs. persistent storage and justify.
-
How you ensure thread safety and consistency.
-
ID generation strategies (auto-increment, UUID, timestamp-based/Snowflake-like): trade-offs for ordering, collisions, and sharding.
-
Performance considerations (time/space complexity, pagination, indexing).
-
Brief testing strategy (functional, concurrency, and performance).
Assume this is a single service used by multiple threads/clients. You may make minimal assumptions explicit to keep the design coherent.