iluwatar/java-design-patterns

May I ask what design pattern is best for this kind of business?

xufei56789 opened this issue · 2 comments

@iluwatar I think it would be best if we use Visitor Design Pattern

@iluwatar I believe the Factory design pattern better matches this business model (and if you plan on using encapsulation to determine the category of the object, this is the best pattern).

Take a look at this link for more information about Factory Pattern (https://refactoring.guru/design-patterns/factory-method)