Steven D'Aprano wrote:
I've never really understand why "abstract factory", "factory method"
and "builder" are considered different design patterns. They're variants on
the same idea.

I think it's because they address different problems. Factories
are for hiding the details of how an object is constructed.
Builders are for working around the fact that there are no
keyword arguments in your language.

Builders are sometimes also used for algorithmic reasons;
e.g. Java's StringBuilder exists to save you from O(n**2)
behaviour when creating a string from many small parts.

Factories of various kinds can be useful in Python;
builders, not so much.

--
Greg
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to