0

I'm having this question because:

I know that builder pattern (as far as I understand) should be used when you have to create complex objects (their constructors are large) and factory is for having a class who is responsible for instantiating objects so you can have low coupling and high cohesion

But, since builder and factory are creational patterns I don't know if using both of them make sense or correct.

thanks in advance.

Teddy S.
  • 33
  • 8
  • A builder *is* a factory. Or do you mean creating the builder using a factory instead of a constructor? That only would be sensible. – Bergi Sep 06 '16 at 13:02
  • Can you post some code of what you have in mind? – Bergi Sep 06 '16 at 13:03
  • @Bergi yeah, that's what I was thinking, having a method in my factory responsible for creating the builder, then, the builder being responsible for creating my complex object (with large constructors). I don't have code right now, I apologize for that, but I'll post it as soon as possible. – Teddy S. Sep 06 '16 at 13:15
  • 1
    @TeddyS.: You might as well drop the "factory object" and just start with the builder right away. It's pure, right? – Bergi Sep 06 '16 at 13:17

0 Answers0