Jump to content

Talk:Dependency injection

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by Guettli (talk | contribs) at 08:10, 22 June 2020 (→‎It is just "configuration" not more :-): new section). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

WikiProject iconComputing: Software Start‑class Mid‑importance
WikiProject iconThis article is within the scope of WikiProject Computing, a collaborative effort to improve the coverage of computers, computing, and information technology on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
StartThis article has been rated as Start-class on Wikipedia's content assessment scale.
MidThis article has been rated as Mid-importance on the project's importance scale.
Taskforce icon
This article is supported by WikiProject Software (assessed as Mid-importance).


Framework based DI Code Example

I highly discourage anybody from using hard coded strings in-line. The example in the last section of the page would be better if we added an static class to it that contains the strings:

//static class provided by the framework or written by the user to indicate which dependencies are available
public static class MyAvailableServices{
    public static final string CarBuilderService = "CarBuilderService";
    public static final string VanBuilderService = "VanBuilderService";
}

public class MyApplication {
    public static void main(String[] args) {
        Service service = (Service)DependencyManager.get(MyAvailableServices.CarBuilderService);
        Car car = (Car)service.getService(Car.class);
        car.setPedalPressure(5);
        float speed = car.getSpeedInMPH();
    }
}

Registry Pattern

Should not this article reference the Registry Pattern which was very prevalent until IoC/DI was popularised?

Is it correct to put inline links to external sites in the article? See links to CDI, Weld, Salta & Dagger in

the version from 2 June 2020, section 'Dependency injection frameworks'

CiaPan (talk) 13:48, 2 June 2020 (UTC)[reply]

It is just "configuration" not more :-)

For me the term "Dependency injection" and the corresponding Wikipedia article are way too complicated.

For me it just "Configuration". But some people don't like it simple, they prefer bloated theory.