# DIY: your own Dependency Injection library!

DevFeed: [DIY: your own Dependency Injection library!](<https://devfeed.tech/articles/diy-your-own-dependency-injection-library-25622.md>)

Original publisher: [Read original article](<https://blog.p-y.wtf/diy-your-own-dependency-injection-library>)

Author: Pierre-Yves Ricau

Published: 2024-01-18T20:08:04Z

Content type: tutorial

Language: en

Sources: [Py's blog](<https://devfeed.tech/sources/py-s-blog.md>)

Topics: [Dependency injection](<https://devfeed.tech/topics/dependency-injection.md>), [Dagger](<https://devfeed.tech/topics/dagger.md>), [Library](<https://devfeed.tech/topics/library.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [api](<https://devfeed.tech/tags/api.md>), [build](<https://devfeed.tech/tags/build.md>), [compiler](<https://devfeed.tech/tags/compiler.md>), [dag](<https://devfeed.tech/tags/dag.md>), [dagger](<https://devfeed.tech/tags/dagger.md>), [dagger-2](<https://devfeed.tech/tags/dagger-2.md>), [dagger-hilt](<https://devfeed.tech/tags/dagger-hilt.md>), [dependencies](<https://devfeed.tech/tags/dependencies.md>), [dependency-graph](<https://devfeed.tech/tags/dependency-graph.md>), [dependency-injection](<https://devfeed.tech/tags/dependency-injection.md>), [di](<https://devfeed.tech/tags/di.md>), [diy](<https://devfeed.tech/tags/diy.md>), [extension-function](<https://devfeed.tech/tags/extension-function.md>), [factory](<https://devfeed.tech/tags/factory.md>), [implement](<https://devfeed.tech/tags/implement.md>), [internals](<https://devfeed.tech/tags/internals.md>), [java](<https://devfeed.tech/tags/java.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [library](<https://devfeed.tech/tags/library.md>), [map](<https://devfeed.tech/tags/map.md>), [module](<https://devfeed.tech/tags/module.md>)

## AI overview

The article builds intuition for dependency injection by progressing from manual construction to simplified versions of Google Guice, Dagger 1, and Dagger 2. Manual injection creates dependencies in order at a dedicated configuration point, but becomes difficult as collaborators grow. The excerpt defines an ObjectGraph as the entry point that supplies requested instances, a Factory as the creator of a type using dependencies from the graph, and a Module as the provider of factories for particular types. The article frames a dependency graph as a DAG and provides Kotlin examples; the supplied text ends while introducing Module, so later implementation details are not available here.

## Source excerpt

Dependency Injection libraries are powerful tools, but they're often also intimidating & confusing. When that happens to me, I find that understanding how a tool works helps me get over the initial scare of the dark magic internals. In this article, ...