I’ve mentioned before that I really don’t like the Abstract Factory pattern, and in particular, code like this:
static IGUIFactory CreateOsSpecificFactory() { string sysType = ConfigurationSettings.AppSettings["OS_TYPE"]; if (sysType == "Win") { return new WindowsFactory(); } else { return new MacFactory(); } }
One of the comments mentioned that this might not be ideal, but it is still better than: