Scala Best Practices I Wish Someone'd Told Me About
summary
Practical Scala coding tips covering concrete pitfalls and fixes: check parity with n % 2 == 0 to handle negative integers, detect NaN using .isNaN, avoid floating-point rounding by keeping values as integers until conversion, and prefer sealed traits with case objects for exhaustive pattern matching. Also recommends returning Option/Either instead of throwing exceptions, annotate recursive functions with @tailrec, avoid implicit conversions that hide runtime errors, and always give explicit types on public APIs.
AI-written summary · about
chapters (16)
- 0:00Intro
- 2:11Checking for oddness
- 3:24Checking for NaN
- 4:34Float in ranges
- 5:53Long literals
- 7:44Enumerations
- 9:41Algebraic Data Types?
- 14:31Sealed traits
- 17:15Case classes
- 18:43Structural types
- 27:50Type annotation
- 29:41String concatenation
- 31:35Exceptions
- 43:09The return keyword
- 47:45Tail recursion
- 49:33Implicit conversions








