Factory Pattern and Singleton Pattern