A few tips on modelling things in Scala
summary
Shows concrete rules: use sealed traits for ADTs and smart constructors for invalid combinations; avoid putting mutable state or side‑effecting resources inside case classes (example: counters disappearing from HashSet; arrays-as-keys bug), wrap raw types to get value semantics; split domain models from DB/JSON DTOs and map at boundaries; use Quicklens or optics macros to update deep immutable fields without verbose copies; consolidate repetitive imports and group implicits so newtype + Refined use stays ergonomic across files.
AI-written summary · about
chapters (8)
- 0:00Introduction
- 1:09Case classes in Scala
- 10:54Mutability in case classes
- 15:53Using toString and show
- 16:14Flat vs nested case classes
- 21:05Sealed traits for domain modeling
- 27:06Avoiding uniform modeling
- 37:18Summary and Q&A
related talks
49mScala best practices I wish someone'd told me about
01h 02mPrinciples and tools to cleverly model your data in Scala
24mFlexible Modeling: Keeping Your Domain Pure with Scala 3
38mThinking Less with Scala
25mEn route to better code
41mEffective Scala
45mDesign Patterns in Scala
35mIntroducing Typelevel Scala into an OO environment
