我们有一个类,它保存应用程序的配置信息。以前是单人模式。在一些架构审查之后,我们被告知移除单例模式。我们确实看到了在单元测试中不使用单例的一些好处,因为我们可以同时测试不同的配置。
Without singleton, we have to pass the instance around everywhere in our code. It's getting so messy so we wrote a singleton wrapper. Now we are porting the same code to PHP and .NET, I am wondering if there is a better pattern we can use for the configuration object.