Hacker News new | past | comments | ask | show | jobs | submit login

'Trying to make dependencies substitutable is overengineering and leads to poor design...'

I absolutely agree with this[1]. However, DI does not require this. You can do DI without substitution by default, you can still easily do unit testing, and you can make dependencies explicit. To be fair, I had to build my own framework to make this work exactly the way I wanted, but I also wanted a built in actor framework. I don't have examples of how I do testing, or other features I use, but you can get a feel for explicit injection by default from the readme I made: https://github.com/caseymarquis/KC.Actin

I'm sure there's some established DI framework which uses concrete types by default, and substitution when required. If not, it's not rocket science to roll your own.

1. Substitution by default is useful when you're building a library for mass consumption, but libraries typically don't need DI.




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

Search: