re: 4 Dangerous Problems in JavaScript Easily Solved by The Builder Design Pattern VIEW POST


One difference between those two approaches is:

  • with big constructor - you set all params as required
  • with builder - you don't have to call them all

In normal approach you had full object ready to go, which isn't the same with builder for this example.
Imagine if we always need to create a frog with 10 params (Base Frog for example), is it really better to do it builder way? I think it is not.

To be clear builder is great pattern, but we should always operate on object which is ready to go without extras ;)

code of conduct - report abuse