Lesson 2: Designing classes that work together
19 min read·14 Oct 2026
Module 9 · Lesson 2 · About 50 minutes · Needs: Module 9 Lesson 1 (class,__init__,self, methods), Module 8 (raising and catching errors), Module 7 (thebooknookpackage,date)
The situation
Lesson 1 gave you four classes: Book, Member, Loan and Library. Now Amira wants them to behave like the shelf. Kwame has three books out on Wednesday 14 October, so the program must refuse him a fourth. Nobody may borrow Emma while Sofia has the only copy. And she has a new book for the café: a thesaurus that stays at the counter and is never lent.
That is a design job: which class holds which fact, and when one class should be a special kind of another.