Wednesday, October 4, 2017

Builder Patten


When the request reaches code responsible for creating objects, It will call the director/composer, Then composer will call the builder, Then builder will  call appropriate concrete creator (here sedan creator) Then concrete creator will call all the part creators. Then  Part creator will create the parts and if required it will connect to database for raw materials, Then return it to the creator.  Then creator will return it to the builder. Then builder will return it to the director. Then director will assemble each parts creates the object and return it to the requester.

Notes:
  • Usually builder patter is used when the construction process is same for all concrete creators even though each part creation is different for each creators. 
  • The original requester is in touch only with director. here director is in touch with builder. If tomorrow builder changes the concrete creator or concrete creator changes its  part creators all these changes will not affect the original requester. 
check here for grafffitoid version of other design patterns

No comments:

Post a Comment