SHSubjectHub

Validation and Setters (Python)

OOPA-levelLesson packSubscription

About this resource

Learn how to enforce rules on data using validation in constructors and setter methods, and how to use delegation to avoid duplicating logic.

11 slides.

Lesson outline

  1. Validation — Where Does it Go?
  2. Validation in __init__
  3. Setter Methods
  4. The Delegation Pattern
  5. Thermostat: Full Demo
  6. UML: Thermostat Class Design
  7. Clamping or Rejection?
  8. Coding Practice: Thermostat + PasswordVault
  9. Lesson Summary
Unit bundleUnit 2B · Validation and Setters
Part of: Unit 2B · Validation and Setters: the whole unitEvery resource in the unit in one zip.

More from Unit 2B · Validation and Setters