Abstract Factory Pattern Gamma Categorization: Creational Design Patten Summary: When the object construction is complicated, needing multiple arguments, we should create a separate function (Factory Method) or class (Factory), which is responsible for the creation of the all object. Problem examples Suport of multiple databases Multiple data sources: Serial port, ethernet port, device driver Diferent report types Solution Abstract class Generalized interface A Factory creates instances of the concrete classes Sample Code The abstract factory public interface IPhotoFactory { IAnaloguePhoto CreateAnaloguePhoto (); IDigitalPhoto CreateDigitalPhoto (); } The abstract products public interface IAnaloguePhoto { string GetName (); } public interface IDigitalPhoto { ...
software engineering