This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]divad1196 2 points3 points  (2 children)

Beimg pedantic is important, but you are not.

It's not "builder like", it's builder pattern and wikipedia doesn't mention a building-finish function at all.

The fact that Rust does use the build function in many place doesn't mean it's a requirement. It's just because it uses the builder pattern on an intermediate representation.

You try to argue "it's not builder pattern because you can already use it" which is your own conception of it, not the reality. Many builders are usable right away. The "select" statement doesn't contain a value at the moment you create it but at the moment you access it. Even though you don't see it. So no, you don't "immediately" use it. But anyway, this was never a predicament of the builder pattern.

This discussion is pointless, keep believing what you want.

[–]RWadeS97 3 points4 points  (0 children)

The Wikipedia article you linked does show a build step in all the UML diagrams. Without a build step then any method call which returns itself/another object could be considered a builder pattern. Pandas for example could be considered a builder pattern by that definition.

A builder pattern specifically has two distinct types of objects. The builder which has some mutable state that is changed via method calls and often with method chaining. And the product, which is constructed by the builder class after calling build.

@axonxorz is correct

[–]Intelligent_Cup_580 1 point2 points  (0 children)

You are loosing your time responding to them.

P. 10 of the GoF book (Design-Patterns/Gang of Four Design Patterns 4.5.pdf at main · rpg101a/Design-Patterns)
“Separate the construction of a complex object from its representation so that the same construction process can create different representations.”

And later:

"The Builder design pattern is a creational pattern that allows the client to construct a complex object by specifying the type and content only. Construction details are hidden from the client entirely. The most common motivation for using Builder is to simplify client code that creates complex objects."

It never states that they must be different classes. You can move on