Like many other software engineering organizations, Tagged is moving toward a more test-aware development culture. Dependency injection can be a powerful tool to assist in the adoption of test-driven (or at least test-friendly) development techniques.
Dependency injection is a technique useful for dividing a complex design into smaller, simpler parts. This results in more flexible designs with greater testability. It can help you better understand your own designs and makes the mechanisms of interaction between components more clear. It might seem like extra work up front, but it pays off in fewer time-consuming headaches later.
The Stig project uses dependency injection routinely. It helps us avoid dependency cycles, which can easily snowball into nightmares of spaghetti code.
Check out the video of my Tech Talk below for a more in-depth look at Dependency Injection at Tagged.
Jason Lucas is the scalability architect for Tagged, one of the largest social networking system in the world. Jason previously worked for Google on large-scale, distributed systems and for Microsoft on the Visual C++ compiler. He also spent almost ten years working on artificial intelligence systems for treating HIV/AIDS in Africa. These days Jason focuses on problems in the NoSQL space, creating planetary-scale data services that are reliable, fast, cheap, and, if at all possible, easy to use.