Factory Method Pattern
Factory method pattern is a creational design pattern that provides an interface for creating an object, but let subclasses decide which class to instantiate. Factory Method lets a class defer instantiation to subclasses.
Problem
Lets imagine we are ...
thkarropoulos.hashnode.dev2 min read
Markos Korvesis
Software Engineer
Even though I would avoid the Greek pizza on the menu, this is a lovely and well-structured article!
I have two concerns, which are out of the scope of this article of course, but I will mention them anyway. π
This switch statement will eventually become hard to maintain if the pizza is tasty and the business grows to add more entries to the menu. Additionally, I would consider throwing an exception in the default branch and removing the spinach from the Greek pizza as a good practice.
Good job, Theodoros Karropoulos!