Dependency Injection vs Factory Pattern

When using a factory your code is still actually responsible for creating objects. By DI you outsource that responsibility to another class or a framework, which is separate from your code.

Leave a Comment