Design Patterns in C#

Paths

Design Patterns in C#

Authors: Marc Gilbert, Filip Ekberg, Steve Michelotti, Vladimir Khorikov, David Starr, Harrison Ferrone, Steve Smith, David Berry

Design patterns have evolved from years of experience in resolving frequently encountered problems when writing object-oriented software. These patterns are templates that... Read more

Each of these courses will focus on a specific design pattern. By the end of each course, you will understand how the different components of the design pattern work together and how to use them in your own applications by demonstrating real-world practical step-by-step examples written in C#.

Pre-requisites

• Intermediate level of C# • Beginning level Visual Studio or Visual Studio Code

Behavioral

Behavioral design patterns are concerned with algorithms and the assignment of responsibilities between objects.

C# Design Patterns: State

by Marc Gilbert

Nov 9, 2019 / 44m

44m

Start Course
Description

Are you looking for a way to better manage state in your application? Are your methods loaded with complex condition logic that’s hard to follow, debug, and maintain? In this course, C# Design Patterns: State, you will learn a tried and true design pattern for handling any situation in which the behavior of entities in your application changes based on context or state. First, you will explore the concept of state including what it is and its implications for development. Next, you will review some traditional approaches to managing state like if-else statements and switches and examine their strengths and shortcomings. Then, you will be introduced to the State Design Pattern and learn why it exists and when to use it. Finally, you will get hands-on experience implementing the pattern in clean and concise way that you can use in any or all of your applications. When you’ve finished this course, you will have the skills and understanding required to implement this elegant solution to handling state in your applications.

Table of contents
  1. Course Overview
  2. The State Design Pattern

C# Design Patterns: Strategy

by Filip Ekberg

Dec 11, 2019 / 40m

40m

Start Course
Description

As your applications grow, you can often find areas which you want to extend. But due to lack of separation and coupling of concrete implementations this can sometimes be hard. An extremely common approach is to leverage interfaces to solve this, which brings us to the strategy pattern. In this course, C# Design Patterns: Strategy, you’ll learn foundational knowledge of the strategy pattern. First, you'll learn how to identify situations where this pattern is applicable. Next, you’ll discover how to easily refactor an application to leverage the strategy pattern, making the application extensible, testable, and easier to work with. Finally, you'll explore how to identify existing implementations of this pattern. When you’re finished with this course, you'll have the skills and knowledge of the strategy pattern needed to apply this in your solutions.

Table of contents
  1. Course Overview
  2. Strategy Pattern

C# Design Patterns: Mediator

by Steve Michelotti

Dec 17, 2019 / 37m

37m

Start Course
Description

For developers looking to deepen their knowledge of design patterns, this code-focused course will fully introduce the mediator design pattern, which enables you to encapsulate object interaction with loose coupling. In this course, C# Design Patterns: Mediator, you will quickly get started with the mediator pattern. First, you will learn what the mediator pattern is and why you would want to use it. Next, you will discover how to implement your own mediator pattern. Finally, you will explore multiple variations of the mediator pattern in different contexts and different applications. When you are finished with this course, you will have the knowledge of the mediator pattern needed to implement and leverage the mediator pattern in your own C# applications.

Table of contents
  1. Course Overview
  2. Mediator Pattern

C# Design Patterns: Command

by Filip Ekberg

Sep 24, 2019 / 26m

26m

Start Course
Description

Most, if not all software developers will need to be familiar with the command pattern and how commands are executed within applications in C# during their professional career. In this course, C# Design Patterns: Command, you'll cover everything you need to know to master this pattern and how to implement it into your C# applications. First, you'll uncover what the command pattern is and its characteristics. Next, you'll explore the benefits and tradeoffs when using the command pattern. Then, you'll implement the command pattern in new and existing solutions, as well as identify and leverage existing implementations. By the end of this course you’ll feel comfortable with implementing the command pattern in your applications. This will allow you to build reliable, more extensible and testable applications.

Table of contents
  1. Course Overview
  2. Command Pattern

Specification Pattern in C#

by Vladimir Khorikov

Jun 27, 2017 / 1h 28m

1h 28m

Start Course
Description

Domain-driven design includes many established patterns and practices, and the specification pattern is one of them. In this course, Specification Pattern in C#, you'll learn how to properly implement the specification pattern in practice. First, you'll learn about the use cases for this pattern. Next, you'll explore common anti-patterns and pitfalls in this area. Finally, you'll wrap up the course by learning about how to maintain encapsulation, as well as how to combine different specifications together. By the end of this course, you'll have the necessary knowledge needed to apply this pattern in real-world projects.

Table of contents
  1. Course Overview
  2. Introduction
  3. Implementing the Specification Pattern the Naive Way
  4. Refactoring Towards Better Encapsulation

C# Design Patterns: Null Object

by David Starr

Dec 3, 2019 / 13m

13m

Start Course
Description

Stop null check overload in your code! In this course, C# Design Patterns: Null Object, you will gain the ability to apply a new way of managing null references in your team's codebase. First, you will learn about the source of nulls and how they came to be. Next, you will discover how most people code in defense of nulls, adding hundreds of lines of code inside significant codebases. Finally, you will explore how to use the Null Object pattern to stop these practices and depend on each object you receive by bringing non-null. When you’re finished with this course, you will have the skills and knowledge of null scenarios needed to apply the Null Object pattern.

Table of contents
  1. Course Overview
  2. Introduction

C# Design Patterns: Chain of Responsibility

by Filip Ekberg

Nov 6, 2019 / 41m

41m

Start Course
Description

Software developers need real-world implementation examples of the chain of responsibility pattern to better understand how they can be used in user validation, payment processing, and if/else situations. In this course, C# Design Patterns: Chain of Responsibility, you will gain foundational knowledge of the chain of responsibility pattern. First, you will learn how to identify situations where this pattern is applicable. Next, you will discover how easily this can be refactored into an object oriented approach, which not only is easier to maintain, but also more testable. Finally, you will explore how to identify existing implementations of this pattern. When you’re finished with this course, you will have the skills and knowledge of the chain of responsibility pattern needed to apply this in your solutions.

Table of contents
  1. Course Overview
  2. Chain of Responsibility Pattern

Creational

Creational patterns provide various object creation mechanisms, which increase flexibility and reuse of existing code.

C# Design Patterns: Builder

by Harrison Ferrone

Mar 5, 2020 / 28m

28m

Start Course
Description

At the core of developing flexible, modular C# applications is a foundational knowledge of design patterns and their use cases. In this course, C# Design Patterns: Builder, you’ll learn the skills you need to effectively leverage the Builder design pattern in your own code. First, you’ll learn where the Builder pattern fits into the overall design pattern canon. Next, you’ll dive into its building blocks. Finally, you'll get to see it's correct implementation. When you’re finished with this course, you'll have a firm understanding of the Builder pattern and its effectiveness, as well as a concrete example of how to integrate it into your own projects. Software required: Visual Studio.

Table of contents
  1. Course Overview
  2. Implementing the Builder Pattern

C# Design Patterns: Prototype

by Harrison Ferrone

Mar 5, 2020 / 23m

23m

Start Course
Description

At the core of developing flexible, modular C# applications is a foundational knowledge of design patterns and their use cases. In this course, C# Design Patterns: Prototype, you’ll learn the skills you need to effectively copy objects in your code. First, you’ll learn the theory and basic application of the Prototype pattern. Next, you’ll dive into its concrete implementation. Finally, the general use-cases in software development. When you’re finished with this course, you'll have a firm understanding of the Prototype pattern and its effectiveness, as well as a real-world example of how to integrate it into your own projects. Software required: Visual Studio.

Table of contents
  1. Course Overview
  2. Implementing the Prototype Pattern

Structural

Structural patterns explain how to assemble objects and classes into larger structures while keeping these structures flexible and efficient.

C# Design Patterns: Facade

by David Starr

Dec 12, 2019 / 13m

13m

Start Course
Description

Dealing with a big ball of mud class is annoying and potentially even dangerous. Having to orchestrate the use of many worker or service classes can be very complex, too, leading to code that is hard to read and difficult to manage. In this course, C# Design Patterns: Facade, you'll learn foundational knowledge and gain the ability to overcome these challenges with a simple to apply pattern. First, you'll learn about the need for the pattern in multiple scenarios. Next, you will discover how Facade addresses these problems you see in your code every day. Finally, you'll explore how to use Facade appropriately to help your code be more readable and maintainable to the delight of your team. When you’re finished with this course, you'll have the skills and knowledge of the Facade design pattern needed to use it to improve your code manageability, readability, and elegance.

Table of contents
  1. Course Overview
  2. Introduction Overview

C# Design Patterns: Composite

by Steve Michelotti

Nov 14, 2019 / 34m

34m

Start Course
Description

For developers looking to deepen their knowledge of design patterns, this code-focused course will fully introduce the composite design pattern, which enables you to manage tree structures in a uniform and concise way. In this course, C# Design Patterns: Composite, we’ll cover everything you need to know to quickly get started with the composite pattern. First, you’ll learn what the composite pattern is and why you’d want to use it. Next, you will discover how to implement your own composite pattern. Finally, you will explore existing composite patterns that exist in .NET and how to leverage them effectively. When you are finished with this course, you will have the knowledge of the composite pattern needed to implement and leverage the composite pattern in your own C# applications.

Table of contents
  1. Course Overview
  2. Composite Pattern

C# Design Patterns: Adapter

by Steve Smith

Jan 15, 2020 / 24m

24m

Start Course
Description

Design patterns help you solve common software problems with known, proven approaches. In this course, C# Design Patterns: Adapter, you will learn about the adapter design pattern - one of the most common and useful patterns you'll encounter. It's useful for the very common problem where you want to use a library or service provider, but its interface isn't compatible with what your current code expects. First, you will understand the problem the adapter pattern solves. Next, you will discover what software design principles apply to this pattern. Finally, you will explore how to apply this pattern and frequently used patterns. By the end of this course, you will know when and how to apply the adapter pattern in C#.

Table of contents
  1. Course Overview
  2. Applying the Adapter Pattern

C# Design Patterns: Decorator

by David Berry

Jan 2, 2020 / 32m

32m

Start Course
Description

The decorator design pattern allows you to dynamically add behavior to your classes without modifying the original class. This allows you to layer in new functionality to a class while keeping different concerns cleanly separated. The decorator pattern is especially useful for when you need to apply cross cutting concerns like logging, authorization, and caching, but can also be used to modify data passed to and from an object. Understanding how to apply the decorator pattern gives you a powerful tool when you need to add behavior to and extend the functionality of your classes.

Table of contents
  1. Course Overview
  2. The Decorator Pattern