Content deleted Content added
→Critics: Defence of builder pattern |
m Signing comment by 130.243.188.76 - "→Critics: Defence of builder pattern" |
||
Line 169:
I'm missing the critics section, because the builder pattern is just deeply bad Java, creating a unecessary complex code and nothing else. Probably those people programming builders didn't understand what a constructor is and what a setter and a getter is. Too bad. It should be forbidden. Furthermore, builder are not real object oriented code, so they also need callback patterns, like in the old days with Fortran and C. But callbacks should nowadays be used only for assymetric processes, and not for models at all. That's probably why we need (only) one new programming language in the future, prohibitting all those bad implementation patterns. Or, at least a Java compiler who prohibits it. [[Special:Contributions/178.197.234.31|178.197.234.31]] ([[User talk:178.197.234.31|talk]]) 13:36, 6 June 2013 (UTC)
: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-->
|