refactor of factory design pattern adding components interface and implementation