Code download
1. Concept
Separates the construction of a complex object from its representation to make the same construction
The process can create different representations. Such a design pattern is called the builder pattern.
Key Points
1). Builder: Specifies an abstract interface for each part of a product object.
2) concretebuilder: implements the builder interface to construct and assemble each part of the product, define and define the representation it creates, and provide an interface for retrieving the product.
3) Director: constructs an object using the builder interface.
4), product: indicates the complex object to be constructed. Concretebuilder creates an internal representation of the product and defines its assembly process, including the class that defines the components, including the interfaces that assemble these components into the final product.
2. Class Diagram
Taking nvwa as an example:
3. Test code
Persondirector Pd = new persondirector ();
Person PS = Pd. constructperson (New manbuilder ());
This. Text = ps. Head + "-" + PS. Body + "-" + PS. Foot;
Code download