dimanche 3 juillet 2022

Possible flaw in Builder pattern?

Could someone explain, why do we need to have getResult() method? Why buildPart() has no return value? It seems like an unnecessary step which has no real benefit. Why would we call buildPart() it we don't need the result?

I think it would be much more effective, if buildPart() returns the result.

http://upload.wikimedia.org/wikipedia/commons/thumb/f/f3/Builder_UML_class_diagram.svg/500px-Builder_UML_class_diagram.svg.png

Aucun commentaire:

Enregistrer un commentaire