2 Builders, 1 Code? WithCRTP()
· One min read
Did you ever copy-paste builder methods across similar builders and just accept it?
This is especially painful when creating multi-stage fluent APIs — ones that only expose valid methods at each build step.
CRTP (Curiously Recurring Template Pattern) eliminates this entirely. It lets base classes return the concrete builder type instead of the abstract one.
