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

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -