Contracts & Clojure: The Best-Yet Compromise of Types and Tests
summary
Shows how Prismatic Schema contracts plus test.check generators let Clojure code gain type-like guarantees by validating shapes at runtime and exercising them with property tests; demonstrates refactoring a messy report pipeline into named schemas, generators, and composable validators, and reports a prototype that wraps generators to surface bad samples. Notes limitations: parameterized/produced types, lazy-sequence and higher-order-function checks are tricky. Proposes packaging schemas/generators/test-kit as separate, leavable artifacts so clients can run fast, in-memory experiments against an API.
AI-written summary · about
chapters (10)
- 0:00Introduction and motivation
- 1:50The philosophy of certainty
- 5:49Static types vs. Clojure data
- 9:33Implementing Prismatic Schema
- 12:27Defining and verifying schemas
- 19:30Generative testing
- 22:30Boundaries and limitations
- 31:41Dependency inversion and design
- 37:36Conclusion and summary
- 41:36Q&A and final thoughts
related talks
49mPrismatic's Schema for Server and Client-Side Data Shape Declaration and Validation
31mTesting Made Simple
27mType Your Data!
24mSpeculative Development
43mspec loves data structures
46mTesting in the world of Functional Programming
31mLightning Talks
40mCreating DSLs A tale of spec tacular success and failure
