Avoiding Primitive Obsession Using 6 1/2 Programming Languages
Channel: Jesse Warden
Date: 2022-02-06

We cover why primitive obsession is a problem, and how to solve it in both dynamic and typed languages. Seeing the same technique implemented in various languages helps give you context, see the tradeoffs more clearly, and see how it is a core problem regardless of language and tool set. It'll help make your code more likely to work and more readable for you and your co-workers.

Code: https://github.com/JesterXL/avoiding-primitive-obession

Companion Blog Post: https://jessewarden.com/2022/02/avoiding-primitive-obsession-in-6-%c2%bd-programming-languages.html

0:00 Introduction
3:30 Python Dataclasses
15:45 TypeScript Discriminated Unions and Record Types
24:29 ReScript Variants, Records, and Named Type Aliases
30:15 Elm Types, Records, and Named Type Aliases
36:09 GraphQL, JavaScript, and Apollo - Objects and Records
46:07 Dhall Types, Records, and Functions
55:11 Conclusions