软件设计模式C#
软件设计模式C#
Software Design Patterns in C#
设计模式(Design Patterns)是你在实际应用程序开发中,对不断发现的软件设计问题的重复解决方案。设计模式是关于对象的设计和交互,关于对经常出现的软件开发挑战的一些完美和重用的解决方案,也提供了一个交流平台,
“四人帮”(GOF)模式被认为是所有其他模式的基础,23种设计模式分为3类:创建型模式(Creational Pattern),结构型模式(Structural Pattern)和行为型模式(Behavioral Pattern)。
为了让你先起步,这里提供了2种形式的源码:结构方面的(structural)和现实应用方法的(real-world)。结构方面的代码使用模式定义和UML类图中提供的类型名称,而实际应用方面的代码提供了你需要使用模式的真实设计情况。
Creational Patterns 创建型模式 | |
Creates an instance of several families of classes | |
Separates object construction from its representation | |
Creates an instance of several derived classes | |
A fully initialized instance to be copied or cloned | |
A class of which only a single instance can exist |
Structural Patterns 结构型模式 | |
Match interfaces of different classes | |
Separates an object’s interface from its implementation | |
A tree structure of simple and composite objects | |
Add responsibilities to objects dynamically | |
A single class that represents an entire subsystem | |
A fine-grained instance used for efficient sharing | |
An object representing another object |
Behavioral Patterns 行为型模式 | |
A way of passing a request between a chain of objects | |
Encapsulate a command request as an object | |
A way to include language elements in a program | |
Sequentially access the elements of a collection | |
Defines simplified communication between classes | |
Capture and restore an object's internal state | |
A way of notifying change to a number of classes | |
Alter an object's behavior when its state changes | |
Encapsulates an algorithm inside a class | |
Defer the exact steps of an algorithm to a subclass | |
Defines a new operation to a class without change |
原英文URL:
http://www.dofactory.com/Patterns/Patterns.aspx#list
上述各类模式的链接均提供了简单的解释、UML类图、Structural code(C#)和Real-world code(C#)。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?