Some Servicelocator pattern stinks
I have been working on a somewhat legacy codebase which makes use of the Servicelocator pattern. Although I always thought of Dependecy Injection to be the superior pattern, I was pleased to find some Inversion of Control implementation in there. Working with the codebase, I discovered first hand how easily, when used without caution and discipline, the Servicelocator pattern can introduce code rot. I will walk you through some of the issues I have with the Servicelocator pattern, mostly looking at it from a test perspective. It’s interesting how you can often quickly discover friction in a codebase by just looking at, or writing, tests. ...