Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

DI frameworks were not originally introduced to replace boilerplate.

They were originally intended to move the behavior changes provided by DI from compile time to configuration time.

This was especially valuable when you are delivering enterprise software to sites you don't control and you need to support a wide array of integrations.

They also happen to reduce boilerplate & DI can help with test-ability so they were adopted for that as well, but if you are only doing DI for tests and only using a framework to reduce lines of code it's a fairly widely accepted anti pattern.

I believe your basic assumptions about DI are wrong. The reason it hasn't taken off in the golang world is that the kind of software it was used for is less common & if you are writing it you'd not use golang for a host of reasons, none related to initializer syntax.



Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: