Service Objects With Dry.rb: Monads and Transactions
summary
Claims that Dry::Transaction turns chains of service objects into explicit sequential steps with success/failure monads, using dry-monads and dry-validation, and that TextUs runs this style in production for three years. Shows an authenticate flow implemented with adapters like merge step, try, map, check and t, transactions halting on failure, a matcher DSL that forces exhaustive failure handling, runtime step injection for deterministic tests, and async/maybe adapters for background and optional sub-transactions.
AI-written summary · about
chapters (11)
- 0:00Start
- 1:03The Problem
- 1:55Service Objects
- 3:19Command Pattern
- 9:37Anatomy of a Transaction
- 11:02Maybe Monad
- 22:29Error handling-Matcher DSL
- 24:59Testing - Step Injection
- 26:41Custom Step Adapters
- 26:53Custom Step Adapter - Merge
- 28:29Custom Step Adapter - Validate








