Are global static classes and methods bad?

前端 未结 10 1272
予麋鹿
予麋鹿 2020-12-02 13:36

It\'s generally agreed upon that relying heavily on global stuff is to be avoided. Wouldn\'t using static classes and methods be the same thing?

10条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-02 14:11

    static doesn't necessarely mean global. Classes and members can be static private, hence only applying to the specific class. That said, having too many public static members instead of using appropriate ways to pass data (method calls, callbacks, etc.) is generally bad design.

提交回复
热议问题