Are there any viable alternatives to the GOF Singleton Pattern?

后端 未结 16 1498
佛祖请我去吃肉
佛祖请我去吃肉 2020-11-29 16:58

Let\'s face it. The Singleton Pattern is highly controversial topic with hordes programmers on both sides of the fence. There are those who feel like the Singleto

16条回答
  •  暖寄归人
    2020-11-29 17:39

    Use a plain object and a factory object. The factory is responsible for policing the instance and the plain object details only with the configuration information (it contains for example) and behaviour.

提交回复
热议问题