Talk:Builder pattern: Difference between revisions

Content deleted Content added
SineBot (talk | contribs)
m Signing comment by 130.243.188.76 - "Critics: Defence of builder pattern"
Wrong example: new section
Line 170:
:If somebody comes and says "how am I supposed to do fast parsing without a builder?", you are right in using a builder for loops, like a StringBuilder. But this is a very special case and is only used for parsing Strings. However, for normal objects you should use Externalizable to parse them (newer use Serialisation because it's only 30% Externalizable's speed). So please don't misunderstand me: Builder are okey in a very limited case of String parsing...but then we create the StringBuilder, use it instantly in a loop and afterwards we forget about it. But to use the builder pattern for more than String parsing is just dumb. [[Special:Contributions/178.197.236.254|178.197.236.254]] ([[User talk:178.197.236.254|talk]]) 14:36, 6 June 2013 (UTC)
:Using setters is not a replacement, because setters can cause the object to have an unstable and incomplete form. Builder pattern guarantees that the only object that is modified is the intermediatate object used while creating the final product. When the intermediate object is used up it is discarded. Builder pattern also allows flexible object construction. Suppose you have an object that might need many parameters. <span style="font-size: smaller;" class="autosigned">— Preceding [[Wikipedia:Signatures|unsigned]] comment added by [[Special:Contributions/130.243.188.76|130.243.188.76]] ([[User talk:130.243.188.76|talk]]) 22:50, 13 December 2013 (UTC)</span><!-- Template:Unsigned IP --> <!--Autosigned by SineBot-->
 
== Wrong example ==
 
The pseudocode example does not illustrate the full pattern as described in the GoF book. While we can identify a concrete Builder (CarBuilder) and the product (Car), the Director is somewhat implicit and there is no base Builder class to inherit from.
 
[[User:Javierieh|Javierieh]] ([[User talk:Javierieh|talk]]) 02:51, 11 November 2014 (UTC)