Refactor WorkBench #140
Description
There's a large number of issues with Liquid's service locator, WorkBench
:
-
It's static, which forbids a number of good OOP practices such as inheritance; It also makes testing very difficult (Add unit tests for WorkBench #74) because, once you exercise it, you can no longer change anything. It's also vulnerable to thread-safety issues because every thread will access the same data (although, I must admit, this is unlikely, since you should load instances only at application startup - after that you only read from it).
-
It's a glorified static dictionary. The whole interface is about restricting what can be loaded into it, which is something that the dictionary would do natively (minus the protection over setting something twice, which I wonder if it is really helpful...). The only thing that matters is that it will call Initialize on a service on the first read, which is a good feature.
-
It restricts what can be used as a service.
-
It violates SOLID in every manner I can think, well, besides SRP.
I think a redesign is in order.