Mid-level Track Roadmap

The logic layer: Dry-RB

This course evaluates two Dry-rb libraries against the service objects of a real Rails application. It starts from the Data.define Result objects with a success boolean that most services already use, and names their costs, such as an eight-field failure helper that pads empty values. It then covers Success and Failure from dry-monads, fmap and bind, Do notation, and dry-validation contracts with schemas and rules. It shows how to connect a contract to a service and closes by judging, service by service, whether adoption is worth it.

What you'll learn

  • ✓How Success and Failure replace a success boolean with two distinct types
  • ✓When to use fmap and when to use bind to chain steps that can fail
  • ✓How Do notation keeps a multi-step service flat and stops at the first Failure
  • ✓Writing dry-validation contracts with params schemas and rules
  • ✓Loading the monads extension so to_monad connects a contract to a service
  • ✓Judging, service by service, whether a gem removes a cost the code already has
Free preview · Lesson 1 5 min read

The Result object this app already has

In September 2026, app/services in this application held 65 Ruby files. Forty-nine of them declare a result type with a line shaped like this one, copied from app/services/auth/authenticate_user_service.rb:

Read the full lesson free →

Curriculum

7 lessons
Type to start searching...