Design Patterns in C# and .NET
C# 和 .NET 中的设计模式
了解使用 C# 和 .NET 实现设计模式的新式实现
教程演示🔗
更多开发教程
What you’ll learn 学习内容
-
Recognize and apply design patterns
识别和应用设计模式 -
Refactor existing designs to use design patterns
重构现有设计以使用设计模式 -
Reason about applicability and usability of design patterns
关于设计模式的适用性和可用性的原因
Requirements 要求
-
Good understanding of C# 对 C 语言有很好的理解#
-
Familiarity with latest C# features
熟悉最新的 C# 功能 -
Good understanding of object-oriented design principles
对面向对象设计原则有很好的理解
Description 描述
Course Overview 课程概述
This course provides a comprehensive overview of Design Patterns in C# and .NET from a practical perspective. This course in particular covers patterns with the use of:
本课程从实用的角度全面概述了 C# 和 .NET 中的设计模式。本课程特别涵盖使用以下方法的模式:
- The latest versions of C# and the .NET framework
最新版本的 C# 和 .NET Framework - Use of modern programming approaches: dependency injection, reactive programming and more
使用现代编程方法:依赖注入、响应式编程等 - Use of modern developer tools such as ReSharper
使用现代开发人员工具,例如 ReSharper - Discussions of pattern variations and alternative approaches
模式变化和替代方法的讨论
This course provides an overview of all the Gang of Four (GoF) design patterns as outlined in their seminal book, together with modern-day variations, adjustments, discussions of intrinsic use of patterns in the language.
本课程概述了他们开创性著作中概述的所有四人帮 (GoF) 设计模式,以及现代变化、调整和语言中模式内在使用的讨论。
What are Design Patterns?
什么是设计模式?
Design Patterns are reusable solutions to common programming problems. They were popularized with the 1994 book Design Patterns: Elements of Reusable Object-Oriented Software by Erich Gamma, John Vlissides, Ralph Johnson and Richard Helm (who are commonly known as a Gang of Four, hence the GoF acronym).
设计模式是常见编程问题的可重用解决方案。1994 年,Erich Gamma、John Vlissides、Ralph Johnson 和 Richard Helm(他们通常被称为“四人帮”,因此是 GoF 的首字母缩写)出版了《设计模式:可重用面向对象软件的元素》一书,这些书籍得到了普及。
The original book was written using C++ and Smalltalk as examples, but since then, design patterns have been adapted to every programming language imaginable: C#, Java, PHP and even programming languages that aren’t strictly object-oriented, such as JavaScript.
原书是以C++和Smalltalk为例编写的,但从那时起,设计模式已经适应了所有可以想象的编程语言:C#,Java,PHP甚至不是严格面向对象的编程语言,如JavaScript。
The appeal of design patterns is immortal: we see them in libraries, some of them are intrinsic in programming languages, and you probably use them on a daily basis even if you don’t realize they are there.
设计模式的吸引力是不朽的:我们在库中看到它们,其中一些是编程语言固有的,即使你没有意识到它们的存在,你也可能每天都在使用它们。
What Patterns Does This Course Cover?
本课程涵盖哪些模式?
This course covers all the GoF design patterns. In fact, here’s the full list of what is covered:
本课程涵盖所有 GoF 设计模式。事实上,以下是所涵盖内容的完整列表:
- SOLID Design Principles: Single Responsibility Principle, Open-Closed Principle, Liskov Substitution Principle, Interface Segregation Principle and Dependency Inversion Principle
SOLID设计原则:单责原则、开闭原则、Liskov替换原则、接口隔离原则和依赖反转原则 - Creational Design Patterns: Builder, Factories (Factory Method and Abstract Factory), Prototype and Singleton
创建设计模式:构建器、工厂(工厂方法和抽象工厂)、原型和单例 - Structrural Design Patterns: Adapter, Bridge, Composite, Decorator, Façade, Flyweight and Proxy
结构设计模式:适配器、桥梁、复合材料、装饰器、立面、蝇量级和代理 - Behavioral Design Patterns: Chain of Responsibility, Command, Interpreter, Iterator, Mediator, Memento, Null Object, Observer, State, Strategy, Template Method and Visitor
行为设计模式:责任链、命令、解释器、迭代器、中介、纪念品、空对象、观察者、状态、策略、模板方法和访客
Who Is the Course For?
这门课程是为谁准备的?
This course is for .NET/C# developers who want to see not just textbook examples of design patterns, but also the different variations and tricks that can be applied to implement design patterns in a modern way. For example, the introduction of the DLR allows us to use an ImpromptuObject, so that our DynamicObject exposes any interface we desire. This allows for dynamic programming, and many design patterns are presented in terms of their static and DLR-based variations.
本课程面向 .NET/C# 开发人员,他们不仅希望看到设计模式的教科书示例,还希望看到可用于以现代方式实现设计模式的不同变体和技巧。例如,DLR 的引入允许我们使用 ImpromptuObject,以便我们的 DynamicObject 公开我们想要的任何接口。这允许动态编程,并且许多设计模式都以其静态和基于 DLR 的变化来呈现。
Presentation Style 演讲风格
This course is presented as a (very large) series of live demonstrations being done in Microsoft Visual Studio. Most demos are single-file, so you can download the file attached to the lesson and run it in Visual Studio, Visual Studio Code, Rider or another IDE of your choice.
本课程以 Microsoft Visual Studio 中完成的(非常大的)一系列现场演示的形式呈现。大多数演示都是单个文件,因此你可以下载课程附带的文件,并在 Visual Studio、Visual Studio Code、Rider 或你选择的其他 IDE 中运行它。
This course does not use UML class diagrams; all of demos are live coding. I use Visual Studio, various NuGet packages, R# unit test runner and even dotMemoryUnit.
本课程不使用 UML 类图;所有演示都是实时编码。我使用 Visual Studio、各种 NuGet 包、R# 单元测试运行程序甚至 dotMemoryUnit。
Who this course is for:
本课程适用于谁:
- Beginner and experienced developers
初学者和有经验的开发人员 - Anyone interested in design patterns
任何对设计模式感兴趣的人
更多开发教程