Domain-Driven Refactoring
summary
A procedural handler that loads member and offer data, calls an external rules API, computes expirations and saves changes is refactored step‑by‑step into a cohesive domain model using ReSharper, EF Core and a SmartEnum library. The process extracts a OfferValueCalculator behind an interface, moves expiration logic into an ExpirationType smart enum implementing a strategy per value, replaces public lists with a backing field for EF Core, and applies double‑dispatch so the domain object becomes unit‑testable and persists via value conversion.
AI-written summary · about
chapters (18)
- 0:00Introduction
- 1:50What is DomainDriven Design
- 3:24Domain Model
- 4:42The Problem
- 5:21Test Urban Design
- 5:44Refactoring
- 6:24Books
- 7:53Current State
- 10:54Where is the behavior
- 13:23Mediator
- 15:17Code Walkthrough
- 22:01Reverse Refactoring
- 29:44OfferValue Calculator
- 36:56Expiration Type
- 40:31Assignment and Fixed Expiration Types
- 45:55Abstract Methods
- 50:03Assign Offer Method
- 54:21Assign Offer Logic
related talks
46mDomain-Driven Refactoring
49mDomain-Driven Refactoring
58mImplementing Domain Driven Design as a Pragmatic .NET Developer
59mMapping DDD Domain Models with EF Core 2.1
48mDomain-Driven Design tactically and practically
46mTechnically DDD
59mDomain-Driven Design - Where Rubber Meets the Road
51mDomain - Driven Transformation
