News for hackers. Stuff that matters.
Re:Ask HN: Have you successfully done a career do-over, and ... by Sohcahtoa82 on Wednesday February 14, 2018 @08:45PM (#16381304)
DI is Dependency Injection, which is a $1,000 term for a $5 concept.

A Python class without DI:

    class SomeClass(object):
        def __init__(self):
            self.someDependency = GetDependency()
A Python class WITH DI:

    class SomeClass(object):
        def __init__(self, dependency):
            self.someDependency = dependency
...

That's it. DI is just explicitly passing ("injecting") a dependent object into an object, rather than requiring the object to call a function to get a reference/pointer to the dependency or make one.

There are no comments on this comment yet.