Assertions vs Types: Design by Contract, Deterministic Simulation Testing, and Safety vs Availability (TigerBeetle Vol. 3)In this episode (volume 3), Kai talks with Alex about assertions, type systems, and design by contract, arguing it’s not “types vs assertions” but using both: types for cheap, structural guarantees and assertions where types become too costly or obscure logic. Alex defines assertions (in Zig) as a function that crashes the program on false, explains why disabling assertions in production is dangerous, and ties reliable assertion use to deterministic simulation/generative testing to exercise error paths. We discuss aiming for very high assertion density, repeating weak and strong assertions across call sites and callees to form an interlocking “net,” and note you don’t need special language features for DBC. We also cover safety vs availability tradeoffs, recovery/isolation boundaries (“let it crash” with recovery), TigerBeetle’s approach to correctness, a real cache/hash-table bug caught by an assertion, handling poison-pill failures via fix-forward and frequent releases, control plane vs data plane performance tactics for assertions, and why Alex doesn’t use AI to write TigerBeetle code.Chapters:00:00 Welcome and Intro01:33 Assertions Versus Types03:05 Silver Bullets Origins08:10 When Types Get Costly11:06 What Is an Assertion?12:40 Never Disable Assertions15:30 Testing and Error Paths19:52 Simulation Testing Harness22:50 Where to Assert Everywhere27:01 Redundant Contracts Benefits33:08 No Language Features Needed38:01 Visibility and Abstractions40:47 Boundaries and Integration44:01 Safety Versus Liveness Setup44:31 Safety vs Availability Tradeoffs46:16 Let It Crash Philosophy47:13 Isolation and Recovery Boundaries48:02 TigerBeetle vs IDE Priorities53:48 Always Assertions Pattern55:46 Cascading Failures in Clusters57:57 Fix Forward and Fast Releases01:02:27 Worst TigerBeetle Bug Story01:07:00 Control Plane vs Data Plane01:09:50 Assertion Performance Tactics01:15:18 AI Limits for Safety Systems01:18:55 Closing Advice on AssertionsFor memberships: join this channel as a member here:https://www.youtube.com/channel/UC_mGuY4g0mggeUGM6V1osdA/joinDon't forget to like, share, and subscribe for more insights!=============================================================================Like building stuff? Try out CodeCrafters and build amazing real world systems like Redis, Kafka, Sqlite. Use the link below to signup and get 40% off on paid subscription.https://app.codecrafters.io/join?via=geeknarrator=============================================================================Database internals series: https://youtu.be/yV_Zp0Mi3xsPopular playlists:Realtime streaming systems: https://www.youtube.com/playlist?list=PLL7QpTxsA4se-mAKKoVOs3VcaP71X_LA-Software Engineering: https://www.youtube.com/playlist?list=PLL7QpTxsA4sf6By03bot5BhKoMgxDUU17Distributed systems and databases: https://www.youtube.com/playlist?list=PLL7QpTxsA4sfLDUnjBJXJGFhhz94jDd_dModern databases: https://www.youtube.com/playlist?list=PLL7QpTxsA4scSeZAsCUXijtnfW5ARlrsNStay Curios! Keep Learning!