Preparing your design workspace

Loading the problem and your saved attempt…

Design and Implement an Extensible Order Sales Counter

Model immutable orders and produce atomic item and category sales counts through replaceable item-reading and classification boundaries.

For this exercise, assume an analytics client submits one finite ordered batch of immutable orders. Each order has a unique order ID and timestamp. A supplied item-reading dependency returns a finite sequence of nonempty item identifiers for an order, and each occurrence represents one sold unit.

The primary report counts units by item. Callers may also register independent classification dimensions, such as category, that map an item identifier to one bucket; adding a dimension must not require changing the aggregation workflow.

A duplicate order ID, item-reading failure, blank item identifier, or classifier failure rejects the entire run, so no partial report is published. Counts use signed 64-bit arithmetic. Assume at most 200,000 orders and 5,000,000 returned item occurrences.

Inventory mutation, payments, refunds, durable production persistence, distributed execution, and user interfaces are outside the base scope. For the final scalability follow-up only, compare optional ephemeral local spill files or versioned checkpoints as adaptations; they are not required in the implemented core.

Design the object model, contracts, and interactions, then implement the bounded in-memory aggregation core.