Check the rules in build
transcript
A ride request has rules. Three stops at most. Pickup and drop must differ. Where do you check them? In each setter? For some rules, that works. Not for all.
The stop setter could refuse a fourth stop. That one rule fits there. But pickup and drop must differ needs two values. Set on separate screens, either could come first. Build sees every value. Every rule runs there, once, for every request.
Three stops at most. A note of 40 characters at most. And all of them live in one place: build.
Hand over the builder's own list, and a reused builder changes finished requests. Copy the list in build. Each request keeps its own stops, even if the builder is reused.
What comes back has no setters. Nobody can change it afterwards. It was valid when built, and it stays valid. You can share it freely.
The builder collects values. Build checks them. Every rule, once, with all the values in.
Full breakdown in the lecture.