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

> Instead of calling B from A, you have to wrap B in an interface, instantiate it, pass it to A, and make the call.

There is a place for interfaces, but not all dependencies need to be interfaces. The database handle mentioned in the previous comment is a good example of where dependency injection can be useful without the need for interfaces. In your configuration example, a string path to the configuration file might be the useful dependency.



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

Search: