In some environments, using dependency injection (DI) and inversion of control (IoC) are not only a nice-to-have, but an expected requirement. And while DI and IoC can provide a nice abstraction away from your concrete classes, there are times, when working in a brownfield application for example, that you might find yourself in the position of simply not having the luxury of time to wire in one of these frameworks. However, that does not mean that we can not strive to accomplish what these frameworks aim to provide for us: loose coupling.
So with that in mind, I want to share a method of loosely coupled classes by way of reflection. And in the spirit of three letter acronyms (TLA), I call this pattern reflection of control (RoC).
[Read more…]