3 ms·
I don't have a good name for it, but I used the same pattern 20ish years ago for game engine stuff. Java folks might have a name. It's similar to the Foo().bar
by aappleby 3y ago
I don't have a good name for it, but I used the same pattern 20ish years ago for game engine stuff.
Java folks might have a name. It's similar to the Foo().bar().baz() constructor pattern.
- jacques_chester 3y agoI think you're thinking of the Builder pattern. That's a bit different, because you return the same type and same object on every chained call.
- iainmerrick 3y agoNo, I think it is the same thing. Typically¹ with a Builder there's one final method that builds and returns the final object (which has a different type). ¹ Edit to add: well, it's a pattern I've seen a lot, anyway. I think it's preferable to mutating the final object in place because it "makes illegal states unrepresentable" as others in this discussion have mentioned.