The Builder Pattern is a software design pattern where the logic to set up an object is separated from the actual object.
As discussed last time, this patterns is particularly useful when dealing with
immutable types where all the information about the object is often required at the time of construction. The builder pattern
allows the information required to construct the object to be collected separately by code with different concerns, until
the point Build
is called to actually construct the object.
With code generation baked into roslyn, patterns such as the Builder Pattern which often require a lot of boilerplate code will be extremely simple to automate. In this post we will investigate how easy this really is.