What is the difference between Factory and Strategy patterns?

A factory pattern is a creational pattern. A strategy pattern is an operational pattern. Put another way, a factory pattern is used to create objects of a specific type. A strategy pattern is use to perform an operation (or set of operations) in a particular manner. In the classic example, a factory might create different … Read more

Factory, Abstract Factory and Factory Method

The Gang Of Four “Design Patterns; Elements of Reusable Object-Oriented Software” book contains two entries, “Abstract Factory” (aka ‘Virtual Constructor’) and “Factory Method”. I don’t know about “Concrete Factory.” I’ve heard the term, but never given it too much thought. Factory Method In “Factory Method” an object has a method which is responsible for the … Read more

Avoiding all DI antipatterns for types requiring asynchronous initialization

This is a long answer. There’s a summary at the end. Scroll down to the summary if you’re in a hurry. The problem you have, and the application you’re building, is a-typical. It’s a-typical for two reasons: you need (or rather want) asynchronous start-up initialization, and Your application framework (azure functions) supports asynchronous start-up initialization … Read more

What is the basic difference between the Factory and Abstract Factory Design Patterns? [closed]

With the Factory pattern, you produce instances of implementations (Apple, Banana, Cherry, etc.) of a particular interface — say, IFruit. With the Abstract Factory pattern, you provide a way for anyone to provide their own factory. This allows your warehouse to be either an IFruitFactory or an IJuiceFactory, without requiring your warehouse to know anything … Read more

What are the differences between Abstract Factory and Factory design patterns?

The Difference Between The Two The main difference between a “factory method” and an “abstract factory” is that the factory method is a method, and an abstract factory is an object. I think a lot of people get these two terms confused, and start using them interchangeably. I remember that I had a hard time … Read more