Thógann an patrún Builder oibiachtaí casta céim-ar-céim, ag scaradh an tógála ó dhíolúine. Tá sé an-úsáideach go háirithe do oibiachtaí le go leor paraiméadar nó codanna roghnach, agus táirgeann sé tógáil réada inléite, solúbtha in ionad tógálaithe fánach.
An fhadhb a réitíonn Builder
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.
