Growing a DSL for financial calculations
summary
Rabobank mortgage calculations move from opaque Java BigDecimal code into a small internal Scala DSL with full compile‑time checks, custom Amount and Percentage types, a Quantity type class to make multiplication safe, and a Period/Per design that enforces amount per month vs amount per year. The team replaces confusing literals (that stray 1200) with typed constructs, reuses existing Java tests to validate correctness, and business analysts begin reading and even committing DSL rules; code is open sourced.
AI-written summary · about
chapters (13)
- 0:00Intro
- 0:54Rabobank
- 3:49Java code
- 8:50Scala code
- 11:07Multiplication
- 11:33Type classes
- 14:08Implicit multiplication
- 14:35Monthly and yearly amounts
- 16:45Infix notation
- 18:53Summary
- 19:14The code
- 24:44New project
- 26:04Questions
related talks
45mDesign and Effectiveness of Internal DSLs in Scala
34mBuilding a DSL… in Kotlin!
37mFull Stack Scala Web Application
35mFrom Zero to Three - Building a User Friendly DSL with Scala 3
41mTeaching Domain Specific Languages in Scala
33mFrom Domain Models to Domain Languages with Tagless-Final
50mAbstract application specifications language in Scala DSL
30mLessons Learned from 15 Years of Scala in the Wild
