Module 08 · System Design · Low-level design: classes, properly
Tell everyone who cares (Observer and State)
Tell Everyone Who Cares · Open board
The model with two views, the book’s watcher list, and the loan state machine with five of nine moves allowed.
Before you start. A design pattern is a named, reusable way of arranging classes. This lesson uses two, and builds on three earlier ideas. From Swap the rule, keep the class (Strategy and Factory), the swappable part (the strategy pattern): an object holds a rule object inside and can be handed a different one, without knowing which. From Five letters, one shop (SOLID), the trap: having to edit code that already worked every time something new is added. From The object that keeps its own rules (encapsulation and invariants), one object guarding its own state, meaning the facts it remembers right now. The example is a library book, and a book remembers three things: where it is, who has it, and who is waiting.
Lesson 40 of 73 in System Design
The rest of this lesson is part of a plan.
A plan opens every lesson, board, video, lab and paper on chalk. Yearly is $39/year, or $19.50 for your first year with LAUNCH50, ends 1 Nov, 18:30 UTC.