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.

Required fields*

5
  • Thanks Ben. I've honestly only worked with IOC Containers for about a year, and though I don't do it, tutorials and peers around me really focus on property injection (including private). It's crazy, and it brings up all the points I make. But even if others are in this situation, I think the best thing they can do is learn more about how IOC Containers should work to follow principles, and point out these principle-breakers in code reviews. However... (continued) Commented Sep 20, 2014 at 13:28
  • My biggest concern isn't necessarily listed in OOP/SOLID Principles, and that is explicitness of scope. I still we are throwing Block, Local, Module, and Global level scope understanding out the window for a keyword. The whole idea of using blocks, and declarations determining when something falls out of scope or is disposed is huge for me, and I think that was the scariest part of IOC Containers for me, to replace that very basic piece of development with an extension keyword. Commented Sep 20, 2014 at 13:32
  • So I marked your response as the answer because it really does address the heart of this. And the way I read it is that you just have to trust what IOC Containers do under the covers because everybody else does. And as far as the openings to possible misuse and the elegant way it covers it up, that's for a shop and code reviews to worry about and they should do their due diligence to follow good development principles. Commented Sep 20, 2014 at 13:34
  • 2
    In regards to 4, Dependency Injection is not in the SOLID acronym. 'D' = 'Dependency Inversion Principle', which is a totally unrelated concept. Commented May 8, 2015 at 15:29
  • @astr Good point. I've replaced "injection" with "inversion" as I think that's what I meant to write in the first place. That's still a bit of an over-simplification as dependency inversion doesn't necessarily imply multiple concrete implementations, but I think the meaning is clear enough. It would be dangerous to depend on a polymorphic abstraction if switching out implementations was an OCP violation. Commented May 8, 2015 at 15:53