views:

249

answers:

2

I know this question is asked many times but I just want to clear more on this. Can a builder pattern replace factory pattern.

Yes Builder pattern create and return a complex object step by step and this can be done in factory pattern also.

+5  A: 

They are both Creational patterns. So, not replace, just an alternative that's appropriate under some conditions. The nature of patterns is that they present solutions to common problems, it's quite reasonable that subtly different problems have different solutions.

All discussed here, maybe it's more interesting if you tell us what you didn't understand or agree with about the answers here

djna
+1 I agree about the need of information
neuro
A: 

For more information on when to use the Builder Pattern and its advantages you should check out my post for another similar question here

Kamikaze Mercenary