Is global constants an anti-pattern?

后端 未结 7 1649
再見小時候
再見小時候 2020-12-03 03:29

I\'ve always thought having a class just for the sake of holding constants is a bad design. But recently, I\'ve tried googling for it and found only that having an inter

7条回答
  •  时光说笑
    2020-12-03 04:28

    Global variables have been widely recognized as a bad thing and generally should be avoided. This is why so many people have an issue with the Singleton Pattern. The trouble with global variables is that they are transitive.

提交回复
热议问题