Breaking Dependencies: Type Erasure - A Design Analysis
summary
Claims that replacing inheritance with type erasure significantly reduces coupling and simplifies maintenance by extracting operations from domain types into a value wrapper that erases concrete types at runtime. Implementation uses a templated constructor, an internal model/base pair and a clone method (prototype) to provide value semantics, combining external polymorphism with the classic bridge and prototype patterns. The concrete build is a Shape wrapper that stores circles/squares without pointers in user code, works at runtime, and has libraries (boost type_erasure dyno zoo) and SBO strategies to regain performance.
AI-written summary · about
chapters (11)
- 0:00Introduction
- 2:10Design and dependencies challenge
- 4:59Naive inheritance problems
- 9:32Strategy design pattern
- 23:28Strategy pattern limitations
- 26:58What type erasure is
- 31:58External polymorphism
- 37:19Bridge and prototype patterns
- 42:13Type erasure with shapes
- 50:28Benefits and trade-offs
- 56:26Q&A
related talks
01h 03mBreaking Dependencies: type erasure - a design analysis
01h 03mType Erasure - The Implementation Details
01h 01mBreaking Dependencies - C++ Type Erasure - The Implementation Details
44mPragmatic Type Erasure: Solving OOP Problems w/ Elegant Design Pattern
01h 01mPractical Type Erasure
58mDeconstructing Inheritance
01h 05mExpressing Implementation Sameness and Similarity - Polymorphism in Modern C++
36mThe language that isn't
