Are Dependency Injection and Mixins the same thing?
I am trying to get accustomed to the ways of PHP 5.3 and I am confused. :o
Are the开发者_StackOverflow社区y both accomplishing the same thing?
No, they are very different. Dependency injection means "give me all of the objects I need to do my task." A good counter-example would be a class that uses other singleton classes or has other hard-coded dependencies.
Mixins are essentially objects or classes that you can more or less merge with an existing object or class to provide its behavior to the consumer of that object.
精彩评论