Forum Post: RE: do you inject ?

  • Thread starter Thread starter Bronco
  • Start date Start date
Status
Not open for further replies.
B

Bronco

Guest
I guess that the line is where a concrete application calls generic functionality. For example, you have a CachingManager class, and this CachingManager is programmed against the ICaching interface. The implementation of ICaching is injected. So this could be a DbCaching class or a MemoryCaching class or whatever caching you can come up with.The concrete implementation of ICaching is injected into the CachingManager by the application which uses the CachingManager (iow: who has the need for caching). This is sound because the application (read: the programmer) should know on the application level which type of cache works best at the particular situation. As far as instantiation goes, the application could bluntly istantiate a cache type (class) and inject it or instantiate it via a factory which get it's information from a configuration file (in which case the used caching strategy is externalized). I hope this makes sense.

Continue reading...
 
Status
Not open for further replies.
Back
Top