Design patterns implementation examples

Builder

Definition:

Separetes object's creation procedure from object's representation (the same creation procedure-different representation)


Example:

Good analogy from every day’s life may be a following situation: an artist makes an object (according to his own procedure) but each time he gets a different product. All items are made using the same technique but are not the same. It might be, for instance, because the artist had chosen a different paint composition.


C++ code:

/src/builder.cpp
Download source code

Builder UML class diagram:
Builder UML class diagram

Builder UML sequence diagram:
Builder UML sequence diagram