design patterns - Service Locator - Disadvantages over DI -
both of these achieve same goal of decoupling. different patterns.
1.) disadvantages of service locator on di? couple of them if got right.
- needs container. component needs container code
- unit testing hard.
2.) advantages of sl on di?
- kind of provides encapsulation of dependencies.
- no need explicitly advertise dependencies.
3.) when use what? (di/sl). real life examples?
this has been discussed in several thread. there no real concise answer this.
Comments
Post a Comment