Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why don't languages integrate Dependency Injection at the core? [closed]

Why don't languages integrate Dependency Injection in their core (at the lowest level : compilation maybe) since dependencies are the root of all evil in Complexity Theory? This would avoid to use Frameworks.

I'm rather targeting compiled languages.

My question is similar to duck typing that has been introduced recently with dynamics in .NET. Why not something similar in the future for DI?

like image 761
user310291 Avatar asked Apr 18 '11 12:04

user310291


People also ask

Which of the below is a major limitation of dependency injection?

Disadvantages of Dependency Injection: Dependency injection creates clients that demand configuration details to be supplied by construction code. This can be difficult when obvious defaults are available. Dependency injection can make code difficult to trace (read) because it separates behaviour from construction.

What is dependency injection in net core?

ASP.NET Core supports the dependency injection (DI) software design pattern, which is a technique for achieving Inversion of Control (IoC) between classes and their dependencies. For more information specific to dependency injection within MVC controllers, see Dependency injection into controllers in ASP.NET Core.

Can we use dependency injection to create drivers?

We can use dependency injection. To recap, our Car is currently responsible for the creation of its Driver. But what we actually want is to have the Driver dependency injected into the Car. The Car does not care where the Driver comes from, as long as it gets a working one. We want to use what we are given, rather than what we create. Fig 5.

What is Dependency Injection (DI) in spring?

The task of instantiating objects is done by the container according to the configurations specified by the developer. There are two types of Spring Dependency Injection. They are: Setter Dependency Injection (SDI): This is the simpler of the two DI methods. In this, the DI will be injected with the help of setter and/or getter methods.

When to use CDI and SDI in a bean?

Preferred option when properties on the bean are more and immutable objects (eg: financial processes) are important for application. We have used three classes and an interface as beans to exemplify the concepts of CDI and SDI. They are Vehicle, ToyotaEngine, Tyres classes and IEngine interface respectively.


1 Answers

Because languages are design/design-pattern neutral.

like image 62
Aliostad Avatar answered Oct 13 '22 01:10

Aliostad