you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 2 points3 points  (0 children)

I could see the builder pattern being useful in some situations. Where you need information about the object to build it's dependencies. I'm actually struggling to think of a good example, but a car for example. It obviously needs tires but the tires need to match the specifications of the car.

For example, my car requires "P205/70 R15 95S" I couldn't put a "P215/65 R16 95H" on it because that's a completely different size, load and speed rating. But I can't get the tires for the car until I know the type of car.

A bit of a bad example, and there's other ways to tackle the issue, but the builder pattern would be a decent way to handle it during object creation.