Implementation of Abstract Factory design pattern