Week 3 Part II · API and Persistence
Instructor lesson plan: lecture (2 h) and practice (2 h).
.NET test runnercode analyzersrefactoring toolsarchitecture sketches
| 0:00-0:10 | 10 min | RetrievalStudents show one entity and one invariant from week 2. |
| 0:10-0:35 | 25 min | Single responsibility and cohesion
|
| 0:35-0:55 | 20 min | Open-closed and strategyReplace conditional policy blocks with named policies only when variation is real. |
| 0:55-1:10 | 15 min | Liskov and interface segregationContracts, substitutability, and focused interfaces. |
| 1:10-1:20 | 10 min | Break |
| 1:20-1:45 | 25 min | Dependency inversion
|
| 1:45-2:00 | 15 min | Clean code in teamsNames, small functions, reviewability, and refactoring as a normal activity. |
Students often think: every class needs an interface.
Set it straight: introduce an interface when it protects a boundary, supports variation, or protects a boundary.
| 0:00-0:20 | 20 min | Smell huntReview a deliberately messy service and identify responsibilities. |
| 0:20-0:55 | 35 min | Guided refactor
|
| 0:55-1:10 | 15 min | Team reviewEach team names one class in its project with too many reasons to change. |
| 1:10-1:20 | 10 min | Break |
| 1:20-1:50 | 30 min | Project refactorTeams refactor one domain or service area and document the preserved behavior. |
| 1:50-2:00 | 10 min | Project-integration briefSubmit a short note explaining the refactor and why it improves maintainability. |