Use Builders... Cautiously - Effective Java, Item 2

Why and how to avoid the builder pattern and how to make best use of it if you can't

Always embed videos

(and give me a cookie to remember - privacy policy)

Watch on YouTube

The builder pattern is a powerful tool to ease the instantiation of complex classes. Whether constructor parameters are too numerous, there are too many of the same type, or whether many are optional - with a builder you can make your life easier. Although, I posit, often you can make your life even easier by directly tackling the class' or constructor's complexity.

In this video I show an example of how to simplify a class to make a builder obsolete, but also how to build more powerful builders that add more value than just simplifying constructor calls.

Links to follow up: