We may earn an affiliate commission when you visit our partners.
Packt Publishing

Design patterns are reusable solutions to common programming problems. They speed up the development process by providing tested, proven development paradigms. This course starts at the nuts-and-bolts level and shows you everything through to advanced patterns and features, going in-depth to give you the knowledge you need.

Read more

Design patterns are reusable solutions to common programming problems. They speed up the development process by providing tested, proven development paradigms. This course starts at the nuts-and-bolts level and shows you everything through to advanced patterns and features, going in-depth to give you the knowledge you need.

You will begin this course with an introduction to SOLID principles, which will introduce you to clean-code concepts and will elevate your skills. With this knowledge in your toolbox, you will be ready to move on to studying creational design patterns, patterns related to the creation of objects, such as Singleton, Factory, and Dependency Injection. You will then acquire more in-depth knowledge of one specific creational pattern, the Dependency Inversion pattern, which will teach you how to write highly extensible, maintainable, and testable code. Moving on, you will get your hands dirty with structural design patterns and you will complete this course by learning the last group of patterns: behavioral design patterns.

By the end of this course you will be very confident in implementing a new feature in C# and .NET Core because, every time you have a problem, the correct design pattern will spontaneously come to mind.

This course uses .NET Core 2.0, and VS2017 community edition+, while not the latest version available, it provides relevant and informative content for legacy users of .NET Core, and Visual Studio.

About the Author

Dimitris Loukas is a software engineer currently writing Single Page Applications and  using the latest JavaScript with Aurelia, Angular, C#, and .NET Core for  a trading software firm. He has worked for two start-ups in the past,  is active in the open source community, and loves taking up small  side-projects. He has mastered Angular, Aurelia, and Vue.JS and is now  interested in entering the ReactJS world. He is an early adopter of .NET  Core and is fascinated by modern JavaScript and where the web is going.

Enroll now

What's inside

Learning objectives

  • Write better code by exploring solid principles
  • Group design patterns
  • Maintain and expand your code with dependency inversion in modern c# applications
  • Get familiar with the singleton design pattern to work with single instances
  • Use singleton along with an ioc container
  • Explore the concepts of loose coupling
  • Look for value changes using the observer pattern
  • Implement interchangeable algorithms with the strategy pattern
  • Go from inheritance to composition

Syllabus

SOLID Principles

This video provides an overview of the entire course.

SOLID principles can upgrade the code someone writes. The problem is, they are complex.

  • Describe what SOLID means
  • Brief summary of all principles
Read more

It’s fairly common for developers to write classes that do more than one thing.

  • Demonstrate an example of such a class
  • Refactor the class to adhere to the single responsibility principle

The open/closed principle is rarely used as developers keep adding stuff to their classes.

  • Describe what closed to modification means
  • Explain what open to extension means
  • Demonstrate a comprehensive example

The Liskov substitution principle is perhaps the hardest of the five. We need to provide a high quality explanation without making the video long and boring.

  • Theoretical examination
  • Use a quiz app example

According to the interface segregation principle, a class shouldn’t be forced to implement a method that it does not need or can’t implement.

  • Go straight to an example of an interface that is wrongfully used
  • Split that interface into two interfaces
  • Implement them separately

Dependency Inversion is so vital that a part of it, Dependency Injection will have its own section. But for now we need to demonstrate how important it is.

  • Explain Dependency Inversion and loose coupling in theory
  • Demonstrate tight coupling’s downsizes
  • Implement a service the correct way by connecting to an abstraction
Creational Design Patterns

In this video, we will work almost exclusively with patterns so introductions are in order.

  • Describe design patterns in general
  • Briefly explain each creational pattern that we are going to study

Sometimes we need to only have a single instance of a class.

  • Describe singleton theoretically
  • Implement singleton with a PrimaryPlayer class
  • Note limitations and downsides

Following the single responsibility principle, our consumer classes shouldn’t be the ones responsible for knowing how to instantiate classes that we need.

  • Describe the factory pattern in theory
  • Create an EnemyFactory

We need to take care of a few stuff in the course project. This presents a nice opportunity to involve the concept of Loose Coupling.

  • Create an Iweapon interface
  • Create different weapon implementations
  • Add them to the player and attack an enemy

The Object Pool is a great pattern to avoid having to be constantly initializing our enemy classes every time we need them.

  • Modify the EnemyFactory to work with object pools
  • Create a pool for the Zombie class
  • Add a reclaim mechanism
Dependency Injection

Not all C# developers are familiar with Dependency Injection and since we are dedicating a whole section on it we better spend a video trying to explain the most interesting topics.

  • Explain Dependency Injection thoroughly
  • Show a very simplistic visual example

There’s great value in creating a Custom IoC Container. The viewer will get to understand the inner workings of Dependency Injection.

  • Describe the vital operations that an IoC Container needs to be doing
  • Implement the registration method
  • Implement the Dependency resolution method

The Custom Container is good for educational purposes but we need something more robust. So we have to move on to the built-in ASP.NET Core IoC Container.

  • Create an ICardsService interface
  • Create a CardsService concrete implementation
  • Register the implementation as a Singleton and inject it to a controller

The ASP.NET Core Container offers three different registration strategies. We need to make the distinctions clear.

  • Describe the three strategies and decide on the best one for the task at hand
  • Create a method that tests the API connection
  • Consume the API project from the console application
Structural Design Patterns

Sometimes we want to combine objects while maintaining their types. To do that we use the decorator pattern.

  • Use figures to explain what the decorator pattern does
  • Use the decorator pattern to decorate cards with items

We must make use of a foreign interface. We need to make it work with what we already have. That’s what the adapter pattern is for.

  • Introduce a 3rd party library to the project
  • Work with the adapter pattern to circumvent it

The Gameboard class is getting more and more complicated.

  • Theoretical introduction to the facade pattern
  • Use the facade pattern to simplify the Gameboard

We want to provide a way to iterate through decks of cards as well as decks of decks.

  • Describe the composite pattern
  • Create a common IComposite interface

We want to quickly and easily fetch data from the API in a loosely coupled way.

  • Decouple the service from the implementation
  • Use a proxy class to fetch the data
Behavioral Design Patterns

Sometimes we need to choose an algorithm at runtime. The strategy pattern is perfect at doing that.

  • Describe the need for the strategy pattern
  • Create two strategies for showing messages

Watching the primary player’s health is better than just using strategy.

  • Create a HealthChanged event
  • Register observers
  • Combine them with the strategy pattern

We need a way to encapsulate the battles between players and enemies as well as cards and enemies.

  • Create an ICommand interface
  • Create two command implementations
  • Group them into a list and execute

The template method defines an abstract base class that forces sub-classes to only implement part of the functionality.

  • Create a template for rendering the battlefield
  • Create different battlefields that will be randomly generated

The state pattern offers a convenience class to store data about your sessions.

  • Create a state class
  • Store statistics there

Good to know

Know what's good
, what to watch for
, and possible dealbreakers
Explores SOLID principles, which are essential for writing clean, maintainable, and testable code in modern C# applications, enhancing overall software quality
Covers creational, structural, and behavioral design patterns, providing a comprehensive understanding of design solutions applicable to various programming challenges
Teaches Dependency Injection, a vital technique for building loosely coupled applications, and explores its implementation using both custom and built-in ASP.NET Core IoC containers
Uses .NET Core 2.0 and VS2017 community edition+, which may not be the latest, but still provides relevant and informative content for legacy users of .NET Core and Visual Studio
Includes hands-on examples and practical implementations of design patterns, allowing learners to apply theoretical knowledge to real-world coding scenarios
Taught by an early adopter of .NET Core, who is active in the open source community, and has experience working with modern JavaScript frameworks

Save this course

Save Design Patterns using C# and .NET Core to your list so you can find it easily later:
Save

Activities

Be better prepared before your course. Deepen your understanding during and after it. Supplement your coursework and achieve mastery of the topics covered in Design Patterns using C# and .NET Core with these activities:
Review SOLID Principles
Reinforce your understanding of SOLID principles before diving into design patterns. This will provide a strong foundation for understanding the 'why' behind many patterns.
Browse courses on SOLID Principles
Show steps
  • Read articles and blog posts about SOLID principles.
  • Watch videos explaining each principle with examples.
  • Try to identify SOLID principles in existing codebases.
Review: 'Head First Design Patterns'
Supplement your learning with a more visual and engaging explanation of design patterns. This can help solidify your understanding of the core concepts.
Show steps
  • Read the chapters on the patterns that you find most challenging.
  • Work through the exercises and examples in the book.
  • Compare the explanations in the book with the explanations in the course.
Review: 'Design Patterns: Elements of Reusable Object-Oriented Software'
Gain a deeper understanding of design patterns by studying the foundational text in the field. This will provide a broader context for the patterns covered in the course.
View Design Patterns on Amazon
Show steps
  • Read the introductory chapters to understand the motivation behind design patterns.
  • Select a few patterns covered in the course and read their corresponding chapters in the book.
  • Compare the examples in the book with the C# examples in the course.
Four other activities
Expand to see all activities and additional details
Show all seven activities
Refactor Existing Code Using Design Patterns
Improve your ability to recognize and apply design patterns by refactoring existing code. This will help you develop a sense for when and how to use each pattern.
Show steps
  • Find a piece of existing code that could benefit from design patterns.
  • Identify the patterns that would be most appropriate for refactoring the code.
  • Refactor the code using the chosen design patterns.
  • Compare the original code with the refactored code to see the improvements.
Implement a Simple Game with Design Patterns
Solidify your understanding of design patterns by applying them in a practical project. This will help you see how the patterns work together in a real-world scenario.
Show steps
  • Choose a simple game like Tic-Tac-Toe or a card game.
  • Identify opportunities to apply design patterns like Strategy, Observer, or Factory.
  • Implement the game using the chosen design patterns.
  • Refactor the code to improve its design and maintainability.
Create a Blog Post Explaining a Design Pattern
Deepen your understanding of a specific design pattern by explaining it in your own words. This will force you to think critically about the pattern and its applications.
Show steps
  • Choose a design pattern from the course.
  • Research the pattern and its applications.
  • Write a blog post explaining the pattern in simple terms.
  • Include code examples in C# to illustrate the pattern.
  • Publish the blog post on a platform like Medium or your own website.
Contribute to an Open Source Project Using Design Patterns
Apply your knowledge of design patterns in a real-world project and collaborate with other developers. This will provide valuable experience and help you learn from others.
Show steps
  • Find an open-source project that uses C# and .NET Core.
  • Identify areas where design patterns could be applied to improve the code.
  • Contribute code that implements the chosen design patterns.
  • Participate in code reviews and discussions with other developers.

Career center

Learners who complete Design Patterns using C# and .NET Core will develop knowledge and skills that may be useful to these careers:
Software Developer
A software developer creates and maintains software applications. This course helps a software developer understand and implement various design patterns in C# and .NET Core. This includes creational, structural and behavioral patterns. By working through this course and delving into SOLID principles, the software developer learns to write cleaner, more maintainable, and testable code, essential for producing high-quality software. Knowledge gained from this course allows a software developer to approach problem-solving with proven solutions, improving overall efficiency.
Application Developer
An application developer designs, develops, and implements computer applications. This course is particularly relevant to an application developer as it thoroughly explores design patterns in C# and .NET Core. The course covers a variety of design patterns, from creational like Singleton and Factory to structural and behavioral patterns. The focus on SOLID principles within this course is vital for writing modular, extensible, and testable code, making the application developer better equipped to handle complex software projects. The design patterns covered allow the application developer to build robust and well-structured applications.
Backend Developer
A backend developer is responsible for the server-side logic and databases of applications. This course in design patterns helps a backend developer create and maintain robust systems using C# and .NET Core. The course helps with implementing common design solutions, from creational patterns to behavioral patterns. The focus on SOLID principles combined with dependency injection and inversion techniques make a backend developer better equipped to handle larger projects. The patterns taught in this course allows a backend developer to design more efficient and scalable systems.
Full-Stack Developer
A full stack developer is involved in both front-end and back-end development. This course, which helps in implementing design patterns in C# and .NET Core, is useful for the back-end aspect of the role, as it teaches how to build scalable and maintainable back-end systems. A full stack developer who takes this course learns to create more efficient and robust applications by using design patterns. SOLID principles covered in the course also help to write clean and testable code. This course allows a full stack developer to improve their skills in building robust, scalable applications.
Systems Architect
A systems architect designs and implements the structure of complex software systems. This course is beneficial to a systems architect because it delves deeply into design patterns in C# and .NET Core, providing a framework for structuring code effectively. The coverage of SOLID principles further helps a systems architect make informed choices around code maintainability and extensibility. The course's emphasis on design patterns like Singleton, Factory, and Dependency Injection helps a systems architect design systems that are scalable and easy to maintain. This course helps a systems architect in designing more robust and adaptable systems.
Technical Lead
A technical lead guides software development teams and makes key technical decisions. This course, covering design patterns in C# and .NET Core, is highly applicable as this role requires a strong understanding of software architecture and design. By learning SOLID principles and various design patterns, a technical lead is equipped to make informed decisions about code structure, maintainability, and extensibility. The technical lead benefits from the in-depth study of creational, structural, and behavioral patterns. This course allows technical leads to better direct their teams in creating well-designed software.
Software Architect
A software architect designs the high-level structure of software systems. This course may be helpful to a software architect due to its in-depth coverage of design patterns in C# and .NET Core. A software architect needs to understand how to structure complex software solutions efficiently. This course covers essential creational, structural, and behavioral patterns along with SOLID principles, providing the knowledge needed to create maintainable and extensible systems. The software architect is better prepared to make architectural decisions due to the hands-on experience with various design patterns. This course may be useful for those who desire to become more proficient in software design and architecture.
Solutions Architect
A solutions architect designs technology solutions to solve business problems. The design patterns this course explores in C# and .NET Core help a solutions architect make informed decisions about software architecture and design. Such a role requires a broad knowledge of different design patterns to identify the correct solution for various problems, and this course provides an excellent way to achieve that. The focus on SOLID principles supports the creation of modular and scalable systems. This course may provide a solutions architect with additional design knowledge in .NET environments.
Game Developer
A game developer creates video games using programming languages and design principles. This course on design patterns, using C# and .NET Core, is particularly valuable for a game developer. The knowledge of creational, structural, and behavioral patterns allows game developers to structure their code efficiently, making game logic more organized and maintainable. The SOLID principles taught in the course help game developers write cleaner and more scalable code. This course improves the game developer's skills for coding complex and demanding game applications.
Cloud Engineer
A cloud engineer is responsible for implementing, managing, and maintaining cloud computing systems. This course, which focuses on design patterns in C# and .NET Core, may be relevant to a cloud engineer, particularly when developing cloud applications. The course content, which includes understanding SOLID principles and various design patterns, may be helpful in writing better code and designing scalable applications. Cloud engineers may find this course useful for optimizing the performance and maintainability of cloud-based applications built on .NET technologies. This course may improve a cloud engineer's knowledge in building and deploying cloud applications.
Data Engineer
A data engineer builds and maintains data pipelines and infrastructure. While not directly focused on data, this course has value for a data engineer who may work with .NET-based tools. The course's focus on design patterns in C# and .NET Core, coupled with SOLID principles, offers insights into writing maintainable and extensible code. Understanding design patterns may be helpful when building data processing applications or tools in .NET. The skills learned in this course may be helpful in building more organized and robust data systems with .NET.
embedded systems developer
An embedded systems developer writes code for hardware devices. This course may be useful as this role sometimes requires C#/.NET and this course teaches design patterns. The focus on writing maintainable and extensible code through SOLID principles, various design patterns including creational, structural, and behavioral patterns may also be beneficial. Though this course does not specifically teach embedded programming, it's focus on good coding practices is helpful. This course may be useful for embedded systems developers that want to improve the quality of their code.
Quality Assurance Engineer
A quality assurance engineer tests software to ensure it meets quality standards. This course may be relevant to a quality assurance engineer because a comprehension of design patterns in C# and .NET Core offers insight into the structure and design of the software they test. The understanding of how software is created and designed allows for more effective testing strategies. Although this course does not directly teach testing, it helps improve the quality assurance engineer's understanding of code. This course may be helpful for a quality assurance engineer who wants to deepen their understanding of software development.
DevOps Engineer
A DevOps engineer manages and automates the deployment and infrastructure of software. Knowledge of design patterns in C# and .NET Core, from this course, may be helpful when automating .NET based applications. While the course does not teach DevOps practices, it does focus on writing maintainable and scalable code using SOLID principles and various design patterns. This may be helpful for building tools and scripts. This course may be useful for a DevOps engineer who needs to deal with C# and .NET based projects.
Technical Writer
A technical writer creates documentation for software and technical products. This course, which covers design patterns in C# and .NET Core, may indirectly be helpful to a technical writer by providing them with a better understanding of the concepts they document. This includes a good understanding of SOLID principles and common design patterns, which may help improve technical accuracy. Though the course does not teach technical writing, it provides a deeper understanding of software design. This course may be beneficial for technical writers seeking to understand the software development process more thoroughly.

Reading list

We've selected two books that we think will supplement your learning. Use these to develop background knowledge, enrich your coursework, and gain a deeper understanding of the topics covered in Design Patterns using C# and .NET Core.
Is the seminal work on design patterns, often referred to as the 'Gang of Four' book. It provides a comprehensive overview of common design patterns with detailed explanations and examples. While the examples are not in C#, the underlying concepts are universally applicable. This book is highly recommended as a reference tool for understanding the core principles behind each pattern covered in the course.
Provides a more approachable and engaging introduction to design patterns. It uses a visual and interactive style to explain the concepts, making it easier to understand for beginners. While the examples may not be exclusively in C#, the principles are easily transferable. This book is valuable as additional reading to reinforce the concepts covered in the course.

Share

Help others find this course page by sharing it with your friends and followers:

Similar courses

Similar courses are unavailable at this time. Please try again later.
Our mission

OpenCourser helps millions of learners each year. People visit us to learn workspace skills, ace their exams, and nurture their curiosity.

Our extensive catalog contains over 50,000 courses and twice as many books. Browse by search, by topic, or even by career interests. We'll match you to the right resources quickly.

Find this site helpful? Tell a friend about us.

Affiliate disclosure

We're supported by our community of learners. When you purchase or subscribe to courses and programs or purchase books, we may earn a commission from our partners.

Your purchases help us maintain our catalog and keep our servers humming without ads.

Thank you for supporting OpenCourser.

© 2016 - 2025 OpenCourser