FoundationsLearning library

Object-oriented design

Use objects to model responsibilities, preserve invariants, and evolve small programs.

Beginner18 chapters14 practice questions7 references
Start coursePractise questions

Get an in-app notice when new lessons or practice are added.

18 chapters across 5 modules

Course chapters

Explore all 18 chapters in any order. Each chapter has learning goals, a practice prompt, and a primary reference; expanded reading pages are linked from their chapter titles.

01 · Objects and responsibilities4 chapters
  1. State, behavior, and identity

    • Distinguish an object from the class that describes it

    Practice: Model a library copy rather than a generic noun collection.

    Read the primary referenceLesson guide · Ready
  2. Encapsulation and invariants

    Design objects around valid state and meaningful operations.

    • Explain how methods preserve a valid state

    Practice: Define booking rules and place validation at the right boundary.

    Read the primary referenceExpanded reading · Ready
  3. Constructors and lifecycle

    • Establish valid initial state and explicit ownership

    Practice: Design construction for an object that requires a dependency.

    Read the primary referenceLesson guide · Ready
  4. Value objects and entities

    • Separate equality by value from identity through change

    Practice: Classify an address, money amount, and customer record.

    Read the primary referenceLesson guide · Ready
02 · Contracts and reuse4 chapters
  1. Interfaces and contracts

    • Describe behavior that callers can rely on

    Practice: Specify a notification interface with failure behavior.

    Read the primary referenceLesson guide · Ready
  2. Composition and delegation

    Build a clear object relationship without inheriting implementation unnecessarily.

    • Reuse behavior without coupling to a superclass

    Practice: Compose a report from a data source and formatter.

    Read the primary referenceExpanded reading · Ready
  3. Inheritance and substitution

    • Evaluate whether a subtype preserves caller expectations

    Practice: Find a broken subtype in a payment example.

    Read the primary referenceLesson guide · Ready
  4. Polymorphism

    • Replace type-switching with a shared behavioral contract where useful

    Practice: Implement two storage adapters behind one interface.

    Read the primary referenceLesson guide · Ready
03 · Design quality4 chapters
  1. Cohesion and coupling

    • Group responsibilities that change together

    Practice: Split an oversized user-service class by responsibility.

    Read the primary referenceLesson guide · Ready
  2. Dependency inversion

    • Keep policy independent of infrastructure details

    Practice: Inject a clock or sender into a service.

    Read the primary referenceLesson guide · Ready
  3. Testing object behavior

    • Test public outcomes and important state transitions

    Practice: Write tests around a reservation lifecycle.

    Read the primary referenceLesson guide · Ready
  4. Refactoring safely

    • Change internal structure while preserving observed behavior

    Practice: Replace duplicated branches with a focused collaborator.

    Read the primary referenceLesson guide · Ready
04 · Applied design4 chapters
  1. Strategy and policy objects

    • Represent interchangeable policies without unnecessary abstraction

    Practice: Model two delivery-fee calculations.

    Read the primary referenceLesson guide · Ready
  2. Factories and construction

    • Centralize complex creation when it clarifies ownership

    Practice: Design creation for an object with optional dependencies.

    Read the primary referenceLesson guide · Ready
  3. Events and observers

    • Separate a state change from optional reactions

    Practice: Model a completed-order event with failure considerations.

    Read the primary referenceLesson guide · Ready
  4. Mini project: lending model

    • Apply invariants, contracts, and composition in a small model

    Practice: Design a library lending service with overdue rules.

    Read the primary referenceLesson guide · Ready
05 · Design boundaries in real applications2 chapters
  1. State machines and lifecycle rules

    • Represent permitted transitions explicitly

    Practice: Model a lesson publication workflow with review and retirement states.

    Read the primary referenceLesson guide · Ready
  2. Domain and persistence models

    • Explain why a storage record need not be the public domain interface

    Practice: Map an object to a data record without exposing database details to callers.

    Read the primary referenceLesson guide · Ready

Learn it. Check it. Try again.

14 original questions with worked explanations and source references. Filter by difficulty, revisit mistakes, and save your attempt as you go.

Open Object-oriented design practice

In-depth study guide

Follow the subject from its foundations through worked examples and practice. Each guide includes its scope, version assumptions, solutions, and sources for further study.

OpenLearning study guideEdition 2026.12

Object-oriented design: clear models, reliable behavior

Learn to design understandable object models, protect invariants, choose composition or inheritance, isolate dependencies, and test behavior using runnable Python examples.

pages
76
chapters
15
diagrams
7
exercises with solutions
30

6,982 words of explanations and practice · 15 worked examples · 15 review questions

Improve this guide on GitHubOriginal text · CC BY-SA 4.0

Browse all study guides

Books & references

Free reading at the publisher or author’s site. External materials keep their own licenses.