April 2004
Intermediate to advanced
480 pages
8h 29m
English
The BUILDER pattern moves the construction logic for an object outside the class to instantiate. There are several reasons why you might make this move. You might simply want to reduce the size of a class that has many methods. You might also want to allow step-by-step construction of a target object. This occurs when you acquire the parameters for a constructor gradually, as happens with parsers and may happen with a user interface.
A common situation where you can benefit from BUILDER occurs when data that defines a desired object is embedded in a text string. As your code looks through (that is, parses) the data, you need to store the data as you find it. Whether your parser is XML-based or hand-crafted, ...
Read now
Unlock full access