~/talk

OOP versus Type Classes in Scala

Talkat Scala Love in the City 2021 · on Saturday, 2021-02-13· [scala, functional-programming]
links:none on file
slides:none on file

Compares OOP’s single-dispatch subtype polymorphism (good for resource management, encapsulation and hiding implementation) with type classes as compile-time dictionaries that enable extension, automatic instance derivation via shapeless or magnolia, and practical uses like JSON serializers, a collection-builder sequence implementation, a pure iterator expressed as a state monad, and a safe-logging type class. Shows failures too: monads can’t cleanly become OOP data constructors, f‑bounded polymorphism is awkward, and warns type classes must be coherent and must not keep state. Use OOP for resources and type classes for serialization and data construction.

AI-written summary · about

  1. 0:00Start
  2. 4:35Abstraction
  3. 6:04The Black Box Abstraction
  4. 9:57Subtype Polymorphism
  5. 13:38Parametric Polymorphism
  6. 17:30Type Classes
  7. 20:47Resource Management
  8. 23:47Type Class Super Powers
  9. 31:00Design Patterns
  10. 31:46Use Type Classes for Data Serialization
  11. 39:27Type Classes Must Not Keep State
  12. 40:35Add the Environment
  13. 47:36Output Errors
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.