States the purpose and scope of this document, its notation and conventions, and the design decisions.
This document describes the basic design of an inventory management system for a small bookstore (hereafter “the system”). To realise the requirements set out in the requirements specification, it defines the boundary and architecture of the system, the logical data model and the screens.
Internal design such as physical table definitions and class design is outside the scope of this document and left to the detailed design document.
Lists the design decisions of this system, each with its rationale and the requirements it is based on.
Hold the stock quantity of each book as an attribute of the book, and add to, subtract from or replace that value each time a delivery, sale or stocktake is confirmed.
Totalling the delivery, sale and stocktake history on every stock inquiry gets slower as the history grows. The history is kept (D02), but the figure is the authoritative stock quantity and the history serves the investigation of causes.
Hold deliveries, sales and stocktakes each as an event entity, with no operation to alter or delete them once confirmed. Mistakes are corrected by an event in the opposite direction (such as a reset by a stocktake).
Investigating a stock discrepancy needs an untouched record of what moved stock and when. Allowing updates and deletions for corrections would break the integrity of the record, so corrections are made uniform as events of their own.
Make the ISBN the primary key of the book entity and hold no system-specific running book number. Foreign keys from other entities to a book are ISBNs as well.
Deliveries from suppliers and sales notifications from the payment service both refer to books by ISBN, so an ISBN primary key needs neither a mapping table nor a conversion. The possibility of an ISBN being reused or corrected is accepted under the assumption that every book carried has an ISBN.
Acknowledge a sales notification from the payment service immediately when it is well-formed, save its content as a sale event first and only then deduct from stock. A notification that includes an unregistered ISBN is saved as a pending sale and matched to registered books by a clerk's review.
Making the notification wait for the stock update would delay the checkout at the counter for the system's convenience. Discarding or rejecting the notification both leave the sale out of stock, so acknowledgement and posting are separated and whatever cannot be posted is kept as pending.
Hold the period from the start to the confirmation of a stocktake as a system-wide state, "stocktake in progress", and refuse delivery confirmation, acceptance of sales notifications and confirmation of pending sale reviews while it lasts.
Stocktakes are full counts after closing, so one state for the whole system is simpler than a per-book flag, and the refusal is checked in one place. Partial stocktakes during opening hours are excluded by assumption, and no sales notifications arrive after closing, so refusing them does not stall the checkout.
Record the dates and times of deliveries, sales and stocktakes in the local time of the store's location, with no time zone information.
The subject is a single store, and only its clerks read the dates and times. A time zone would require conversion between screens and records while offering no benefit.
Place the processing that updates stock quantities (addition and subtraction by deliveries and sales, replacement by the counted quantity at a stocktake) and the check that refuses addition and subtraction while a stocktake is in progress in the Stock component. Receiving, Sales and Stocktaking do not write stock quantities themselves but call Stock on confirmation to update them.
Since the figure is the authoritative stock quantity (D01), a missed or doubled update becomes a stock discrepancy outright. With a single path for updates, the refusal during a stocktake (D05) is guarded in the same place, and Receiving, Sales and Stocktaking need not know of one another.
All components share a single database. Writes to each attribute of an entity are confined to the one component responsible for it (Books writes a book's registration, Stock writes its stock quantity). Processing that only reads the events recorded by other components (deliveries, sales, stocktakes and their lines) reads the database directly and does not count as a dependency (a call) between components. Looking a book up by ISBN calls the Books component, so it does count.
The system is a single web application running on one server, and the components are modules within it. Treating reads of events as calls would create a cycle, since a function that spans the records of several business areas, such as the movement history of a stock inquiry, would have the foundation component Stock calling Receiving, Sales and Stocktaking above it. Consistency only requires that the write paths be confined, so reads of events are allowed through the shared database. Book lookup alone goes through the Books component, to keep the check for unregistered ISBNs in one place.