开发者

Static methods vs singletons [duplicate]

This question already has answers here: Closed 11 years ag开发者_开发百科o.

Possible Duplicate:

Why choose a static class over a singleton implementation?

Static methods vs singletons.

Could it be determined choice here?

What are conditions in which one of these approaches is definetely more suitable then other?


Static methods follow the "low coupling and high coherence"-rule more than singletons do. (As long as their implementations don't rely on static member variables.)


If the static methods solve the same problem as the singleton, then why complicate and write a singleton?

Otherwise, why choose something that solves the wrong problem?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜