The Factory Method Pattern

Definition Defines an interface for creating an object, but lets subclasses decide which class to instantiate. The Factory Method lets a class defer instantiation to subclasses. How does it work? The factory method defers the creation of objects to subclasses. This means that instead of creating your objects in your classes like below, you are are deferring to the factory …

Read more

The Strategy Pattern

Definition Defines a family of algorithms, encapsulates each one, and makes them interchangeable. Strategy lets the algorithm vary independently from clients that use it. How does it work? Think of one of those nice digital cameras with the interchangeable lenses like the one pictured below. You can change the lenses on that camera depending on the type of shot you …

Read more

The Observer Pattern in C#


Defines a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically.

Read more