Skip to Content.
Sympa Menu

patterns-discussion - Re: [patterns-discussion] Question - Builder - getResult()

patterns-discussion AT lists.cs.illinois.edu

Subject: General talk about software patterns

List archive

Re: [patterns-discussion] Question - Builder - getResult()


Chronological Thread 
  • From: Carl Asman <carl.asman AT gmx.de>
  • To: patterns-discussion AT cs.uiuc.edu
  • Subject: Re: [patterns-discussion] Question - Builder - getResult()
  • Date: Wed, 09 Nov 2005 15:59:52 +0100
  • List-archive: <http://lists.cs.uiuc.edu/pipermail/patterns-discussion>
  • List-id: General talk about software patterns <patterns-discussion.cs.uiuc.edu>

hm...my .02:

The different concrete builder classes can have different interfaces,
so if you pass back a product, it might look different depending on what
the director built (is it a car, bus, bicycle, etc)
The client need to tell the director what he should build, and he
controls that by passing the correct builder to the director.

using your solution the client would still need to tell the Director
what he wants (e.g. pass a string "car"), and the Director would
instantiate the carbuilder, etc.
But that would mean that whenever you want to add new products (e.g.
aircraft), you have to create an AircraftBuilder, as well as update the
Director so that the director actually can create an Aircraft.
With the GoF solution, there are no need to change the Director class
whenever a new concrete builder is added.

cheers,

Carl Åsman
--
Freelancing software engineer
www.edlin.org

Holger Mügge wrote:
>
> in the builder pattern typically the client directly fetches the built
> product from the concrete builder calling the getResult() method (cf.
> the seqence diagram I attached).
>
> I wonder whether it would be better to let the director do this and
> return the product in its contruction method. I see two advantages: 1.
> the client does not have to know the concrete builder, 2. no
> synchronization is needed in case the client and the director work in
> parallel. Do I overlook something?
>





Archive powered by MHonArc 2.6.16.

Top of Page