Content deleted Content added
broken page markup |
|||
(6 intermediate revisions by 6 users not shown) | |||
Line 1:
{{WikiProject
{{WikiProject Java|auto=inherit|importance=low}} {{WikiProject Computer science
}}
==Why builders?==
Builders are an OOP pattern to construct complex objects without overloading a constructor. The important part is that you don’t need to call all of the steps to construct. You can call only those steps that are necessary for producing a particular configuration of an object. Also a `director` class helps the builder to construct a specific type of object. I'm missing these concepts in the article. [[User:Theking2|Theking2]] ([[User talk:Theking2|talk]]) 20:52, 25 November 2024 (UTC)
:This is helpful. I've read the wiki and it's still isn't entirely clear to me how or why I would use this. [[User:Jgoure|Jgoure]] ([[User talk:Jgoure|talk]]) 21:49, 7 April 2025 (UTC)
==Builders and immutable objects==
Line 79 ⟶ 87:
This seems to say that the Builder manages "the correct sequence of object creation". Is the client the "Director" or is the builder the "Director"? <small>—The preceding [[Wikipedia:Sign your posts on talk pages|unsigned]] comment was added by [[Special:Contributions/61.14.96.7|61.14.96.7]] ([[User talk:61.14.96.7|talk]]) 07:51, 30 April 2007 (UTC).</small><!-- HagermanBot Auto-Unsigned -->
:According to the UML, the client is the Director. And I believe the word "Director" should be replaced with "Client" for clarity and to avoid confusion since some people tend to think "Director" is a class which is part of the pattern. [[Special:Contributions/186.0.181.64|186.0.181.64]] ([[User talk:186.0.181.64|talk]]) 17:46, 10 April 2023 (UTC)
== Missing the Mark ==
Line 151 ⟶ 161:
== Two example implementations ==
I'm not sure we need two example implementations. C++ and Java are not radically different in syntax, and there's nothing about the pattern that can't be covered in one. — [[User:Anndelion|<
:Not terribly impressed by the C++ example either - don't expose pointers, use references instead, and the Builder certainly cannot be a singleton. As an example, use more meaningful names - ideally (necessarily) the same as those in other examples to emphasis the relationship between the representations in different languages. [[Special:Contributions/15.203.137.74|15.203.137.74]] ([[User talk:15.203.137.74|talk]]) 12:19, 26 November 2014 (UTC)
Line 240 ⟶ 250:
A less abstract example might be DocumentBuilder with addParagraph, addImage etc methods. Then we could have a PdfDocumentBuilder, WordDocumentBuilder etc implementations. [[Special:Contributions/81.187.215.34|81.187.215.34]] ([[User talk:81.187.215.34|talk]]) 11:23, 10 July 2016 (UTC)
:The current example is no longer about cars. [[User:Dandv|<span style="text-shadow:lightgrey 0.3em 0.3em 0.15em;">Dandv</span>]] 04:33, 6 October 2022 (UTC)
== UML class and sequence diagram ==
|