Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Design pattern builder 20131115

1,009 views

Published on

Published in: Technology
  • Login to see the comments

  • Be the first to like this

Design pattern builder 20131115

  1. 1. Design Pattern - Builder Bryan Lin 2013/11/15
  2. 2. Agenda • • • • Definition UML diagram Participants Sample code in C#
  3. 3. Definition • Separate the construction of a complex object from its representation so that the same construction process can create different representations
  4. 4. UML diagram
  5. 5. Participants • Builder (VehicleBuilder) o specifies an abstract interface for creating parts of a Product object • ConcreteBuilder (MotorCycleBuilder, CarBuilder, ScooterBuilder) o constructs and assembles parts of the product by implementing the Builder interface o defines and keeps track of the representation it creates o provides an interface for retrieving the product • Director (Shop) o constructs an object using the Builder interface • Product (Vehicle) o represents the complex object under construction. ConcreteBuilder builds the product's internal representation and defines the process by which it's assembled o includes classes that define the constituent parts, including interfaces for assembling the parts into the final result
  6. 6. Sample code in C#
  7. 7. Sample code in C#
  8. 8. Sample code in C#
  9. 9. Sample code in C#
  10. 10. Sample code in C#
  11. 11. FAQ
  12. 12. References http://www.dofactory.com/Patterns/PatternBuild er.aspx

×