|
Prev: normalization != bad performance (was: Relational-to-OOP Tax)
Next: Creating Full Name from given, initials, sn, when some mightbe null
From: parwal.sandeep on 27 Feb 2007 08:42 Hello Group !! I'm newbie in Design pattern. I'm using Builder pattern for my application. i want to know that can Concrete builder have their own private function which can be called by public function which concrete builder has to implement.. or concrete builder can only have the public function .. can any body tell me what is standard for that .. thanks in advance !!! Sandeep
From: H. S. Lahman on 27 Feb 2007 12:03 Responding to Parwal.sandeep... > I'm newbie in Design pattern. > I'm using Builder pattern for my application. > > i want to know that can Concrete builder have their own private > function which can be called by > public function which concrete builder has to implement.. > > or > > concrete builder can only have the public function .. > > can any body tell me what is standard for that .. The concrete builder needs to provide an interface for the [Builder] public function. The polymorphic dispatch depends upon that so the the client does not have to know which flavor of Builder is actually being invoked. However, there is nothing to prevent that implementation from using indirection to a private function: class Builder { public: virtual BuildPart(); ... } class ConcreteBuilder { public: BuildPart() {myPrivateBuildPart();}; ... private: myPrivateBuildPart() ... } ************* There is nothing wrong with me that could not be cured by a capful of Drano. H. S. Lahman hsl(a)pathfindermda.com Pathfinder Solutions http://www.pathfindermda.com blog: http://pathfinderpeople.blogs.com/hslahman "Model-Based Translation: The Next Step in Agile Development". Email info(a)pathfindermda.com for your copy. Pathfinder is hiring: http://www.pathfindermda.com/about_us/careers_pos3.php. (888)OOA-PATH
From: Nick Malik [Microsoft] on 28 Feb 2007 09:12
To add to H.S.Lahman's response, You can combine patterns as well. For example, if you want your concrete builder to use a strategy to construct the object. <calling-code> MyBuildStrategy strat = MyBuildStrategy.StratFactory(); // see factory method pattern MyBuilder bld = MyBuilder.CreateBuilder( strat ); // assign in the strategy to use by builder MyTargetObject myobj = bld.CreateTargetObject(); // when building the object, use the strategy. </calling-code> Of course, if the concrete builder has a one-to-one relationship with the strategy, it is little more than a strategy itself, so the factory method pattern will do with a strategy pattern under it. Depends on how you want to isolate the dependencies. -- --- Nick Malik [Microsoft] MCSD, CFPS, Certified Scrummaster http://blogs.msdn.com/nickmalik Disclaimer: Opinions expressed in this forum are my own, and not representative of my employer. I do not answer questions on behalf of my employer. I'm just a programmer helping programmers. -- <parwal.sandeep(a)gmail.com> wrote in message news:1172583756.430294.30920(a)h3g2000cwc.googlegroups.com... > Hello Group !! > > I'm newbie in Design pattern. > I'm using Builder pattern for my application. > > i want to know that can Concrete builder have their own private > function which can be called by > public function which concrete builder has to implement.. > > or > > concrete builder can only have the public function .. > > can any body tell me what is standard for that .. > > thanks in advance !!! > > Sandeep > |