how to avoid “cascading if\case”-statements in a factory class
问题 I have to create an object based on a specific situation. I read, that the solution could be the Factory Pattern, but in my case it has a lot of disadvantages. For instance: I have an application that manages animals. At some point a client gives to me a list of animals that must be created. A solution by using the factory pattern should be: //PRODUCTS public interface Animal { String getCall(); } public class Dog implements Animal { public String getCall() { return "Bau"; } } public class