Generics
summary
Argues for extracting generics only after concrete code reveals duplication and builds a small networking client that proves the point: concrete model types, a simple client, then a transport protocol that turns URLRequests into Data and a retroactive modeling step that makes URLSession conform without wrappers. Demonstrates concrete code first by factoring out an API-specific base protocol, composes behaviors via composable transports (header-adding wrapper), and shows testing needs only a simple mock transport, not heavyweight mocks.
AI-written summary · about
chapters (5)
- 0:00Start
- 2:19Write concrete code first. Then work out the generics.
- 3:01Real-life protocol design
- 7:10Mocks are a terrible way to design protocols
- 10:53Protocols are for algorithms








