Is it bad practice for a class to have only static fields and methods?

后端 未结 14 730
予麋鹿
予麋鹿 2020-11-30 03:05

I have a class that consists only of static member variables and static methods. Essentially, it is serving as a general-purpose utility class.

Is i

14条回答
  •  鱼传尺愫
    2020-11-30 03:17

    Static methods don't worry me much (except for testing).

    In general, static members are a concern. For example, what if your app is clustered? What about start-up time -- what kind of initialization is taking place? For a consideration of these issues and more, check out this article by Gilad Bracha.

提交回复
热议问题