Hi! In the realm of software development, creating complex objects often feels like trying to solve a…

  • @abhibeckert
    link
    1
    edit-2
    2 years ago

    The main advantage of a builder is you can create an object in multiple steps instead of one step.

    During the builder process the object might temporarily be in an invalid state - for example perhaps you can’t easily access the product price. You wouldn’t want price to be an optional value for the actual product class, but it can be optional for the builder (as long as it’s set once build() is called).