Dead Code

All Models Are Wrong (with James Gayfer)


Listen Later

In this episode of Dead Code, Jared interviews James Gayfer about data modeling and the challenges of structuring databases effectively. James, who prefers raw SQL over ORMs, explains how many database models merely mirror table structures, leading to inefficient APIs and excessive data fetching. He discusses the concept of complete versus incomplete data models, emphasizing that completeness depends on an application’s needs at a given time. They explore trade-offs between overly simplistic models that require frequent queries and overly complex ones that attempt to replicate real-world relationships in unnecessary detail. James advocates for designing domain models thoughtfully, using patterns like repositories to maintain consistency while keeping data retrieval manageable. Ultimately, he encourages developers to embrace iteration, rethink their models as needed, and accept that all models are wrong, but some are useful.


Links:


James Gayfer’s Blog

James Gayfer’s Mastodon profile

SQLx library for Rust

Repository Pattern

Hanami Framework

Phoenix Framework

Ecto

Hotwire

All models are wrong, but some are useful


Dead Code Podcast Links:


Mastodon

X


Jared’s Links:


Mastodon

X

twitch.tv/jardonamron

Jared’s Newsletter & Website


Episode Transcript

Hosted on Acast. See acast.com/privacy for more information.

...more
View all episodesView all episodes
Download on the App Store

Dead CodeBy Jared Norman