General topic questions
Protocol-oriented Design
MediumOccasional
Free section · general topics & algorithms
What is protocol-oriented programming and when is it better than class inheritance?
Reveal model answer
Define behavior via protocols + extensions, compose capabilities, and prefer generics/PAT constraints. Better than deep class hierarchies for testability and reuse without fragile base classes.