开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜