Jeremy D. Miller writes about The Dependency Injection Pattern; or what I've tended to call "Parameterise from above". He covers the various ways you can inject a dependency into a class rather than having the knowledge of the dependency hard wired into the class itself. I tend to favour the constructor injection pattern myself; it's all about breaking concrete coupling with interfaces and then allowing the creator of the object to specify the concrete type used by the object.
As Jeremy says, it's not just for testing; it leads to much more flexible software. It's worth following the link from Jeremy's post to Martin Fowler's "Inversion Of Control and the Dependency Injection pattern" as this is definitive coverage of the technique.Follow me on Twitter: @LenHolgate
About this Entry
I don't think I've ever been disagreed with in Japanese before was the previous entry in this blog.
Walking Managed Stacks with the Profiling API in v2.0 of the CLR is the next entry in this blog.
I usually write about C++ development on Windows platforms, but I often ramble on about other less technical stuff...
Find recent content on the main index or look in the archives to find all content.
Recent Entries
- Breakpoints that are conditional on other breakpoints...
- Be careful what you ask for...
- Framework releases
- Are all fully patched Windows boxes really vulnerable to this easy UDP DDOS attack?
- Strangely fatal UDP issue on Windows...
- Practical Testing: 38 - Bringing the code up to date, again...
- I don't do roadmaps, but...
- C++ Tools - Deleaker
- C++ Tools - CppDepend - 2017 update...
- VMWare bridged networking intermittently failing
I have other blogs...
The Server Framework - high performance server development
Lock Explorer - deadlock detection and multi-threaded performance tools
l'Hexapod - embedded electronics and robotics
I also write about...
.Net
Books
C++ Tips
CC.Net
CLR Hosting
CORBA
Continuous Integration
Debugging Tools
Dumbing down is dumb
ENet
Geek Speak
General
Get a life
Holiday Pictures
Java
Linux
Lock Explorer
Managed XLL
OLEDB
Rants
Refactoring
Reprints
Role Playing
Socket Servers
Sound and Vision
Source Code
Testing
Way back
Winsock Registered I/O
x64
Leave a comment