You are implementing an in-memory task management system (no database required). The system needs basic CRUD features and some ranking/sorting functionality.
Part A — Core data model
A Task can be assigned to multiple people. Model this using a separate Assignment concept.
Design classes (or data structures) such that:
-
Task
stores only
general metadata
, e.g.
taskId
,
title
,
description
,
createdAt
,
priority
, etc.
-
Each
Assignment
represents “this task assigned to this person” and stores assignment-specific fields:
-
assigneeId
-
startTime
-
endTime
-
any other assignment-specific info
-
A single task can have 0..N assignments.
Explain:
-
What fields belong on
Task
vs
Assignment
, and why.
-
How you will link assignments to tasks (IDs, references).
Part B — Operations (CRUD + ranking)
Specify and implement (at least at the interface level) operations such as:
-
Create / read / update / delete tasks
-
Create / update / delete assignments
-
List tasks with a “ranking”/ordering requirement (e.g., sort by priority, due date, created time, or a composite key)
Clarify:
-
What should happen when deleting a task that has assignments.
-
What your ranking key is and whether ties are stable.
Part C — Production/refactor discussion
If this were production code, how would you refactor the solution?
Discuss layering (API/service/storage), validation, error handling, testability, and how you’d evolve the design when requirements change.