SOLID in one page
medium 45 minFive principles for classes that can be changed without fear: single responsibility, open/closed, Liskov substitution, interface segregation and dependency inversion.
Watch lesson5:16
UML design
The final classes, and the letters written on the arrows.
The point: every letter can be seen in the picture. S is the number of boxes, I is the size of the interfaces, D is the direction of the arrows, O is the free place beside the last box, L is what the dashed arrows promise.
Design
Alert service
All five letters in one picture
1/5S
The service keeps the order. The formatter owns the text.
usesimplements
Not drawn, on purpose
| Candidate | Why not |
|---|---|
| Interface for AlertFormatter | One implementation, no outside world |
AbstractSender base class | Nothing to share yet. Retry becomes a decorator, see the FAANG interview pages |
SenderFactory | One composition root is enough |
| ReplyReader in this service | It never reads replies |
| Class per severity | Only a word differs: data |
One alert at run time