Questions tagged [ioc-containers]
The ioc-containers tag has no summary.
51 questions
3
votes
4
answers
337
views
Please explain the "swapable dependency" arguments for IOC containers
I get that IOC containers can be useful to help break dependencies and allow you to test a class in isolation. I don't wish to focus on that right now, instead, I'm trying to understand some of the ...
0
votes
6
answers
1k
views
If it is a bad practice to use an interface if only one class will implement it, what is the purpose of IoC container?
Okay, first of all I understand the concept of IoC container! It's used to implement automatic dependency injection so you won't have to manually inject dependencies to class. It can automatically ...
4
votes
4
answers
1k
views
How to avoid injecting uninitialized dependencies?
I have some components which require some asynchronous calls to be finished before those components are fully initialized and ready for work.
I do not want dependant objects to know about these ...
-1
votes
1
answer
182
views
Containers Across Operating systems
Curious how containers are portable across development/testing/cloud environments with no worry needed about the underlying infrastructure. Does the Docker Engine essentially standardize operating ...
2
votes
2
answers
1k
views
Does SOLID Require an IoC Container (Automatic Factory)?
The fifth concept in the SOLID principle is the dependency inversion principle. It is heavily related to dependency injection, and Inversion of control, and when any of these concepts are mentioned, ...
0
votes
2
answers
2k
views
Passing runtime-read configuration when working with an IoC container
I've recently "discovered" the IoC realm, and decided to refactor a project I'm working on to use such a container.
To be specific - I'm using autofac in C#, in a .NET Core console application.
The ...
123
votes
5
answers
15k
views
What's the difference between using dependency injection with a container and using a service locator?
I understand that directly instantiating dependencies inside a class is considered bad practise. This makes sense as doing so tightly couples everything which in turn makes testing very hard.
Almost ...
1
vote
3
answers
669
views
How to reduce dependency on IOC Framework (Frameworks in general)
I was watching a presentation by Uncle Bob. In the end of that presentation (last 10 min), He argued that we should abstract everything (Even frameworks) from our business logic.
JAVA EE does a great ...
9
votes
1
answer
6k
views
Should .NET Core class libraries register their own implementations?
Our team had recently a big struggle of deciding whether it is a good practice or not for the .NET Core class libraries to register their own implementations by the fact of providing a ...
1
vote
2
answers
281
views
Does an IoC-Container violate the Open/Closed-Principle?
Right now I construct all objects of my application in the root class manually. Since it is getting ugly now, I want to switch to an IoC-Container like Autofac. Now I have to register each interface ...
0
votes
1
answer
502
views
How to deal with complex dependency graph in IOC?
I have several apps witch build from one code base (using common modules).
And my question: how to write composition root in this case?
Let's imagine simple dependency graph:
ClassBase --> ...
3
votes
4
answers
3k
views
Is there a need for an IoC container in TDD unit tests?
While I do see the benefits of IoC containers (as I've used them a fair bit), I don't see how they can be incorporated within TDD unit tests (note, I'm only interested in unit tests here, not ...
18
votes
2
answers
2k
views
Is there evidence that the use of dependency injection improves outcomes in software engineering?
Notwithstanding its popularity, is there any empirical evidence that shows that Dependency Injection (and/or using a DI container) helps with, say, reducing bug counts, improving maintainability, or ...
1
vote
2
answers
163
views
IoC configurations - one file/assembly in solution or one file per executing assembly?
We're wondering what the best practise for registering types in a IoC-Container is.
What would be arguments for and against the following principles:
Principle 1: Only one Assembly my.project....
6
votes
4
answers
3k
views
How to pass data between objects when an IoC container is being used?
I'm working with a project that our architect has decided to use dependency injection for almost everything. We use an IoC container. One of the main issues that I keep coming across when using this ...