factory and singleton design patterns demo