The Opposite of Spaghetti Code: Building for Understanding
summary
A concrete cache is built and evolved: start with a HashMap, add a struct with methods, then tighten ownership and privacy into modules and privacy so the cache controls its own invariants. Trait-based interfaces provide dependency injection and traits as type-level privacy, letting a separate cache-metrics module compute hits and misses without knowing implementation details. The demo shows error-message improvements, uses generics, phantom data and a builder, and argues Rust’s zero-cost abstractions enforce separation while keeping performance, ending with an any-cache composition that works.
AI-written summary · about
chapters (4)
- 0:00Start
- 13:47Error Messages
- 25:49Implementation Delegation Pattern
- 28:58What It Takes To Build an Ecosystem
related talks
19mRust Without Tears: A Guide to Avoiding Common Traps
35mLet’s Talk About Rust
25mType System Tips for the Real World
40mRust’s approach of getting things right
31mThe Rust That Could Have Been
49mThe Eternal Sunshine of the Spotless Programming Language
33mRust and Haskell, sitting in a tree
58mRust for The Curious C++ Developers
