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

Let me turn this around.

In a dynamic language, unit testing is a bad reason to use dependency injection. There are lots of valid reasons to use it. But you don't need it for unit testing.

Returning to DHH's example, if you just want to get the current time in Ruby code, just get it. You can use the dynamic nature of the language to stub that out and unit test it. But you don't need to use dependency injection to enable that. And you really don't need to use a heavy framework.

If you have a different reason to use dependency injection, though, by all means go ahead.



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

Search: