Design problem while using Builder pattern
From: qazmlp (qazmlp1209_at_rediffmail.com)
Date: 01/31/04
- Next message: Mark Thornton: "Re: Join Us for the 2004 No Fluff Just Stuff Java Symposium Tour"
- Previous message: Tony Morris: "Re: difference between hashmap and hashtable"
- Next in thread: BarryNL: "Re: Design problem while using Builder pattern"
- Reply: BarryNL: "Re: Design problem while using Builder pattern"
- Reply: iksrazal: "Re: Design problem while using Builder pattern"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 31 Jan 2004 01:23:34 -0800
Builder pattern seem to suit my requirements perfectly except in one
case
as described below.
I have used the same example diagram that is used in GOF Design
pattern book, to explain the problem that I am facing.
aClient aDirector
aConcreteBuilder
=============================================================================
- new ConcreteBuilder-------------------------------------------->
- new Director(aConcreteBuilder)-------->
- Construct()--------------------------->BuildPartA()------------>
BuildPartB()------------>
BuildPartC()------------>
- GetResult()---------------------------------------------------->
There is no problem in calling BuildPartA(), BuildPartB(),
BuildPartC() as a part of Construct(), for all the ConcreteBuilders.
But, apart from that, one additional function(it is different for each
ConcreteBuilder...different in type and number of arguments) needs to
be called for which aClient has to pass different number&type of
arguments depending on the ConcreteBuilder type.
How do you overcome such a scenario?
Does Builder pattern fit here? Or, do you suggest some other pattern
for this?
Do you find some flaw in the design? And, what are the improvements
that you suggest here?
- Next message: Mark Thornton: "Re: Join Us for the 2004 No Fluff Just Stuff Java Symposium Tour"
- Previous message: Tony Morris: "Re: difference between hashmap and hashtable"
- Next in thread: BarryNL: "Re: Design problem while using Builder pattern"
- Reply: BarryNL: "Re: Design problem while using Builder pattern"
- Reply: iksrazal: "Re: Design problem while using Builder pattern"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|