Factory Method Pattern
References https://refactoring.guru/design-patterns/factory-method What is the Factory Method? Creational design pattern Provides an interface for creating objects in a superclass, but allows subclasses to alter the type of objects that will be created. Situation There is an existing logistics app that uses trucks. As the business grows, you want to add ships to support maritime logistics services. However, Truck is tightly coupled to the entire system, making it difficult to add Ship. Solution The main point of the problem is: ...