2
A
答えて
3
いいえ、それらは非常に異なります。依存性注入とは、「自分の仕事をするために必要なすべてのオブジェクトを私に渡す」という意味です。良い反例は、他のシングルトンクラスを使用するクラス、または他のハードコードされた依存関係を持つクラスです。
ミックスインは基本的にオブジェクトまたはクラスで、既存のオブジェクトまたはクラスとマージして、そのオブジェクトのコンシューマにその動作を提供することができます。
関連する問題
- 1. VaadinとDependency Injection Frameworks
- 2. IValidatableObjectとDependency Injectionのサポート
- 3. Symfony Dependency Injection(Recursively)で同じクラスの複数のオブジェクトを取得するには?
- 4. Microsoft Dependency Injection Library
- 5. OpenRasta Dependency Injection TearDown
- 6. Laravel Controller Dependency Injection
- 7. spring-dependency-injectionの例
- 8. ASP.Net Core RouteBuilderとDependency Injection
- 9. spring 3 annotation dependency injection
- 10. ZF2 AncesorオブジェクトのDependency Injection
- 11. MediatR Dependency Injectionのアップグレード手順
- 12. DDD集合体とエンティティのInversionOfControl(Dependency Injection)
- 13. Android用Lightweight Dependency Injectionフレームワーク
- 14. PlayFramework 2.5テンプレート - Twirl Dependency Injection
- 15. Entity Framework 4 DB-First Dependency Injection?
- 16. AngularJS Dependency Injection VS ES6 Import
- 17. Spring.NET、C#、Dependency Injection and transactions
- 18. Android Dagger2 Dependency Injection to CustomAdapter
- 19. ASP.NET Core MVC Dependency Injection issue
- 20. これはDependency Injectionの正しい使用ですか?
- 21. Aurelia Dependency Injectionの容器は何ですか
- 22. DotNetコアにはまだUnity Dependency Injectionが必要ですか?
- 23. xUnitでDependency Injectionを使用することはできますか?
- 24. JerseyTestの不満依存関係(Dependency Injection)
- 25. シンプルなcatel dependency injectionのやり方
- 26. Apache Spark - Dependency Injection Mechanismを使用することは可能ですか
- 27. AutomapperとUnity Dependency Injectionの併用方法は?
- 28. UMLダイアグラムで@annotionsとDependency Injectionを表示する方法
- 29. ITypeConverterを使用したAutoMapper Dependency Injection
- 30. Jersey 2.x @Contact/Dependency Injection in Scala
もう一つのDIの例は、クラス内の* new *です。追加(PHPではmixinsは存在しません) – KingCrunch
@KingCrunch:はい、 'new'をうまくキャッチします。 mixinに関しては、 '__call'マジックメソッドを使ってPHPでシミュレートすることができます。 – cdhowie
ネイティブではありませんが、ユーザランドに実装されています(symfonyフレームワークの例、sfMixerクラスがあります) – johnjohn