The Strategy Design Pattern in C#

The strategy design pattern allows you to encapsulate a group or family of algorithms, making them interchangeable. This allows code to determine which strategy to use at runtime. The strategy pattern is a behavioral pattern and is one of the original design patterns defined by the Gang of Four (GoF).   What Problem Does It Solve? The strategy pattern allows …

The Observer Design Pattern in C#

The Observer design pattern is a behavioral pattern and was one of the original design patterns defined by the Gang of Four (GoF). The Observer pattern defines a relationship between a publisher, also known as a subject, and one or more subscribers, also known as observers. In this post, I will describe the pattern and show a sample implementation. What …

The Factory Design Pattern in C#

The factory design pattern is a widely accepted and well-regarded creational design pattern. It is one of the original 23 design patterns from the Gang of Four (GoF). The factory design pattern defines an interface for creating new objects instead of using the new keyword but allows classes that implement the interface to decide which class to instantiate. Simply put, the factory …

Software Development Basics – Object-Oriented Programming

Life is complex. Developing software is complex. When creating software that models life, a paradigm is needed to break that complexity down into something that we can comprehend and that can eventually be implemented into a computer program. Object-oriented programming or OOP is one of the best known and most practiced paradigms available. There are four main tenets or concepts that …

Repository Design Pattern in C# Part 2

This is part two of a two part series. The first post covers the thought process that I often go through when implementing the repository design pattern. This post will show a complete implementation. I want to start by saying that I don’t really have a preference as to whether repositories should be coarse-grained or fine-grained. However, I do find that …

Repository Design Pattern in C# Part 1

This is part one of a two part series. This post covers the thought process that I often go through when implementing the repository design pattern. The next post will show a complete implementation. The repository design pattern has become very popular in the .NET ecosystem in recent years mainly because it is a simple data access abstraction that can …