Skip to content
Guest
Learn OOP · Course Syllabus Show lessons
Capstone · 10 min read · Beginner

OOP Capstone: Modular Library System

Combine encapsulation, composition, polymorphism, and SOLID principles to build a clean Library checkout system.

What you'll learn

  • Design collaborating classes with clear single responsibilities
  • Protect item availability with encapsulation
  • Prepare for the OOP Final Exam and Certificate

In this capstone, you will combine all four pillars of OOP into a clean, extensible Library System:

  1. Encapsulation: Book protects #checkedOut so books cannot be double-borrowed.
  2. Polymorphism: Different FinePolicy classes compute late fees differently.
  3. Composition & DI: Library composes a catalog and a FinePolicy.

Fill-in-the-Blank Capstone

Encapsulated Checkout Guard

Prevent borrowing a book that is already checked out.

class Book {
#checkedOut = false;
borrow() {
  if (this.) return false;
  this.#checkedOut = ;
  return true;
}
}

Capstone Playground

Modular OOP Library System
Live Result
Console Output

No console output yet. Try calling console.log(...) in JS.

Check Your Understanding

Score: 0 / 1

1. In the Library capstone, why is FinePolicy passed into Library's constructor instead of hardcoded?

Study Workspace

Finished this lesson?

Your progress is saved locally in your browser, no account needed.

Search courses, lessons, and references

Type to search across all courses, lessons, and quick references.

Press Esc to close Powered by Pagefind