skip to main |
skip to sidebar
Taming Software Dependencies with DI and IoC
with James
Kovacs Concepts
- Dependency Inversion (IoC)
- Higher levels should not rely on lower levels
- Abstraction
- Both should depend on something else (contract)
- Dependency Injection
- supply your dependencies to your objects
- Through the constructor or through setters
- Mandatory in constructor and optional in setters
- Problem:The presenter needs too know about the dependencies below
- Write a default constructor that sets up the dependencies
- At the core a dictionary
- Static gateway from JP is a basic example of this
- Does dependency resolution
Dependencies
- If you pull out a class, how many other classes do you have to copy over too
Notes
- Don't fear the code
- Wizards constrain you
- MVC wizards is a good example
- .Net Pet Has a lot of coupling
- In DDD you use the language of the business
- Use Submit instead of Save for example
- Decorator Pattern
- Add functionality on top of and existing class
- Could we have done WSDBLink as a decorator?
- Use "`" in XML for Generics
Tools
- MS Unity DI tool
- Windsor - OSS DI Software
- StructureMap
- Spring.Net
- Bindsor
- Boo code to set up Windsor
No comments:
Post a Comment