I am trying to understand the factory design pattern and how it can be implemented in Javascript. So far what I understood is factory design pattern helps to create an instance of more specific class that inherits from a general abstract class.
So I was reading this article. I stumbled upon second point of drawbacks of constructors and class which states:
Details of instantiation get leaked into the calling API (via the 'new' [keyword] requirement):
All callers are tightly coupled to the constructor implementation. If you ever need the additional flexibility of the factory, the refactor is a breaking change. Class to factory refactors are common enough that they appear in the seminal Refactoring book, “Refactoring: Improving the Design of Existing Code” by Martin Fowler, Kent Beck, John Brant, William Opdyke, and Don Roberts.
What does details of instantiation get leaked into the calling API mean?