Abstract factory pattern on top of IoC?
Posted
by Sergei
on Stack Overflow
See other posts from Stack Overflow
or by Sergei
Published on 2010-01-03T00:08:08Z
Indexed on
2010/05/18
5:30 UTC
Read the original article
Hit count: 253
I have decided to use IoC principles on a bigger project. However, i would like to get something straight that's been bothering me for a long time. The conclusion that i have come up with is that an IoC container is an architectural pattern, not a design pattern. In other words, no class should be aware of its presence and the container itself should be used at the application layer to stitch up all components. Essentially, it becomes an option, on top of a well designed object-oriented model. Having said that, how is it possible to access resolved types without sprinkling IoC containers all over the place (regardless of whether they are abstracted or not)? The only option i see here is to utilize abstract factories which use an IoC container to resolve concrete types. This should be easy enough to swap out for a set of standard factories. Is this a good approach? Has anyone on here used it and how well did it work for you? Is there anything else available?
Thanks!
© Stack Overflow or respective owner