How Bad Are Singletons?

后端 未结 7 2083
傲寒
傲寒 2021-01-02 22:41

So ....

There are obviously many questions that all have been asked about Singletons, Global State Variables, and all that great stuff. My question is,

7条回答
  •  星月不相逢
    2021-01-02 23:35

    1. Global variables and singletons are popular because they are simple and convenient.
    2. Dependency injection, the only reasonably convenient replacement for global things, is still rather unknown in the PHP-community.
    3. The PHP-community often prefers simple hacks over proper solutions.
    4. Many PHP-developers are quite clueless about programming and know barely enough to make their programs work.

提交回复
热议问题