Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

3
  • I don't understand what you mean about logging. Surely all loggers aren't going to conform to the same interface so you'd have to write your own wrapper to translate between this projects way of logging and a specific logger (assuming you wanted to be able to easily change loggers). So after that what does DI give you? Commented Oct 25, 2015 at 10:27
  • @RichardTingle I'd say that you should define your logging wrapper as an interface, and then you write an lightweight implementation of that interface for each external logging service, instead of using a single logging class that wraps multiple abstractions. It's the same concept you're proposing but abstracted at a different level. Commented Oct 28, 2015 at 16:03
  • DI can help testability in a compiled language by enabling mocking. In an interpreted language, mocking comes out of the box, so this aspect of DI is not a valid argument in the context of interpreted languages. Commented Jan 17, 2022 at 22:40