|
|
|
|
|
by saturn_vk
477 days ago
|
|
> Also DI, which is arguably not necessary at all in Go given how elegantly interfaces work. DI is necessary in every language that doesn't rely solely on global singletons. Passing dependencies as arguments to a function is DI. What may not be necessary, are IOC containers automatically create objects and satisfy their dependencies. |
|
One of the reason people needed a DI framework in Java is crazy "enterprise" configurability requirements and Java EE-based standards that required you to implement a class with a default no-argument constructor. If you're using a web framework like Jooby, Http4k, Ktor or Vert.x, you do not need a DI framework (source: we've written many modern Kotlin applications without a DI framework and we've had zero issues with that).
Of course, all of our non-toy Go applications are using dependency injection as well. Unless the code reviewer messes up, we won't let anyone configure behavior through globals and singletons.