Scale By The Bay 2018 Unconference: Omer Van Kloeten
summary
Claim: move validations from runtime to compile time using Scala libraries so that things like a port are a refined type (Int in 0–65535) and petting APIs reject a cat ID at compile time via tagged IDs or newtype/opaque types. The talk shows concrete patterns: refined, shapeless/newtype macros, sealed‑abstract constructors, and a repository pattern tying Entity and ID. Result: many runtime IllegalArgumentExceptions become compile errors and reduce tests (not eliminate them); IO and external systems remain untypable. Recommend fatal‑warnings and linters.
AI-written summary · about
chapters (14)
- 0:00Introduction and birthday edition
- 0:42Cost of fixing bugs over time
- 2:46Unit testing limitations and pain points
- 3:50Compile-time invariants and refined types
- 9:10Benefits of refined types
- 9:33Limitations of static typing
- 10:16Tests are still essential
- 10:36Value types for domain safety
- 12:24Sealed abstract trick for type safety
- 14:16Tagging and opaque types
- 16:47Newtype and Scala 3 opaque types
- 17:30Persistence and ID separation
- 19:01Typed connections with implicits
- 20:28Key takeaways and build robustness
related talks
34mType Your Business
39mA few tips on modelling things in Scala
29mADVENTURES IN META-PROGRAMMING
35mIntroducing Typelevel Scala into an OO environment
47mScala Rock-Painting
24mLet the Scala compiler work for you
30mLessons Learned from 15 Years of Scala in the Wild
45mTypelevel Programming 101: The Subspace of Scala
