Design an inventory management system
medium 80 minCount goods in several places, promise them to orders without ever promising too much, ship or let go, and explain every count.
Watch lesson4:28
Entities
Which nouns are classes
The point: a noun is a class when it has state that changes under a rule. Most nouns in this task are only names.
Nouns
Keep, or reject aloud
| Noun | Verdict | Why |
|---|---|---|
| Stock line | Class | Two counts with a rule between them |
| Reservation | Class | A life with one ending, and picks to give back |
| Movement | Record | Written once, never changed |
| Pick | Record | The link from a promise to a line |
| Inventory | Class | Order of steps, lock, lookups |
| Pick policy | Interface | A business rule that changes |
| Product | A string here | Name and price belong to the catalogue, which another team owns |
| Warehouse | A string here | It has no rule of its own until it has opening hours or a capacity |
| Order | An id here | It belongs to the shop. We only need to write down whose it is |
| Alert | A call | It is told and forgotten |
State
From requirement to field
| Class | Must know | Must do |
|---|---|---|
StockLine | on hand, held, low mark, warned | add, hold, let go, take, say if it became low |
Reservation | picks, end, status | nothing: Inventory moves it |
Movement | kind, change, reason, number | nothing |
PickPolicy | perhaps an order of places | plan |
Inventory | lines, promises, diary, lock | the public verbs |
Is this noun a class?
Where do the counts live?
BreaksOn the product
- How
product.quantity- Limit
- Cannot say where. With a second place the field becomes a map, and the map becomes a line without a name.
- Choose when
- One place for ever, and no holds.
WorksA map in the warehouse
- How
warehouse.stock[sku] = (on_hand, held)- Limit
- The rule between the two counts sits in the warehouse methods, beside other things. Moving goods needs two warehouses to agree.
- Choose when
- When a warehouse has real rules of its own, such as capacity.
StrongA line for each pair
- How
lines[sku, place]with guarded methods- Limit
- More small objects.
- Choose when
- The default. A lock, a low mark and batches all have a home.