是单调邪恶的单身人士的好表哥吗? [英] Is Monostate the good cousin of the evil Singleton?
本文介绍了是单调邪恶的单身人士的好表哥吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
解决方案
Um,monostate 是 Singleton。 ..所以它有完全相同的问题。
- 测试
- 隐藏依赖
- 不灵活
- 线程安全
- 全局状态难以确保正确性
- testing
- hiding dependencies
- inflexible
- thread safety
- global state makes it difficult to ensure correctness
Singleton is definitely one of the most misused and abused patterns out there. Many of us have been infected with Singletonitis at one point or another. Curiously, its close cousin Monostate is less famous and less used. What is your opinion of Monostate? Good or just as evil? Is it a better alternative to using Singleton? Would you also discourage its use as you would with Singleton?
解决方案
Um, monostate is Singleton... so it has the exact same problems.
这篇关于是单调邪恶的单身人士的好表哥吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文