Thirteen ways of looking at a Turtle
summary
Thirteen concrete implementations of a simple turtle API show actual tradeoffs: mutable OOP and opaque ADT versions, an immutable functional chain, State monad and computation expressions that hide threaded state, result/Either-style Success/Failure error types, async to remove callback pyramids, batch and actor runners, event sourcing and stream processors for replayable history, partial-application functional dependency injection, an interpreter pattern (free monad) that decouples program from runtime, and capability-based APIs. Demos draw a triangle and measure total distance (300), and each technique runs and exposes where it helps or hurts.
AI-written summary · about
chapters (23)
- 0:00Intro
- 1:56Turtle API
- 6:03Advantages and disadvantages
- 13:17Transforming the function #1
- 16:49How to return errors?
- 18:05Implementation usine Result
- 22:06What if the Turtle calls were async?
- 22:58Async usage example
- 23:46Review: Common patterns
- 25:28How to convert a function into data?
- 26:56"execute" implementation
- 27:27"run" implementation
- 29:40Pulling commands off a queue
- 33:25Command vs. Event
- 39:10Turtle stream processing example
- 44:44Same for the Turtle client
- 46:31Overview
- 48:31Partial application in practice
- 50:36APls create coupling
- 53:02Create a "Program" type
- 56:05Turtle Interpreter
- 56:53Distance Interpreter
- 59:45Capability-based API
related talks
01h 06mThirteen ways of looking at a Turtle
01h 07mThirteen ways of looking at a Turtle
42mTaking inspiration from the functional world
42mMonads you already use without knowing it
54mLaziness, trampolines, monoids and other functional amenities
41mLiving the Monadstic Life
33mAnalyzing Functional Programs
31mBoring use cases for exciting types
