0Pricing
Swift Academy · Lesson

Protocol-Oriented Design Principles

Favouring protocol composition over class inheritance for flexible design.

Welcome

Protocol-Oriented Programming (POP) favours protocol composition over class inheritance to build flexible, testable, and reusable Swift code.

The Problem with Inheritance

Deep class hierarchies cause problems: • Subclasses inherit ALL superclass state and behaviour • Changing a superclass can break subclasses • Can't inherit from two classes Protocols solve all three issues.

All lessons in this course

  1. Protocol Composition with &
  2. Conditional Conformance
  3. Self Requirements and Equatable Design
  4. Protocol-Oriented Design Principles
← Back to Swift Academy