Il pattern Builder costruisce oggetti complessi passo-passo, separando la costruzione dalla rappresentazione. È particolarmente utile per oggetti con molti parametri o parti opzionali, producendo una costruzione di oggetti leggibile e flessibile invece di costruttori ingombranti.
Il problema che Builder risolve
Objects with MANY parameters (especially optional ones) lead to problems:
✗ huge constructors: new Pizza('large', true, false, true, 'thin', false, ...) →
unreadable (which boolean is what?); hard to use; error-prone
✗ many constructor overloads (telescoping constructors) → messy
→ Builder provides a clean, readable, step-by-step way to construct such objects.
