The Principles of Design Patterns help you to write code that is flexible, reusable, and easier to maintain. These principles Interfaces enable polymorphic behavior. We can have several implementations of the same interface and decide which of them to use at runtime. Factories hide the complexities of creating objects. Factory classes are coupled to types. Consumer classes depend on interfaces.
Cristian Salcescu is the author of the "Functional JavaScript" and "Functional React" book series. He is a technical lead passionate about front-end development and enthusiastic about sharing ideas. He took different roles and participated in all parts of software creation. Cristian Salcescu is a JavaScript trainer and a writer on Medium.