/ 设计模式 / 目录

结构型模式

结构型模式介绍如何将对象和类组装成较大的结构, 并同时保持结构的灵活和高效。

适配器 适配器 Adapter

让接口不兼容的对象能够相互合作。

桥接 桥接 Bridge

可将一个大类或一系列紧密相关的类拆分为抽象和实现两个独立的层次结构, 从而能在开发时分别使用。

组合 组合 Composite

你可以使用它将对象组合成树状结构, 并且能像使用独立对象一样使用它们。

装饰 装饰 Decorator

允许你通过将对象放入包含行为的特殊封装对象中来为原对象绑定新的行为。

外观 外观 Facade

能为程序库、 框架或其他复杂类提供一个简单的接口。

享元 享元 Flyweight

摒弃了在每个对象中保存所有数据的方式, 通过共享多个对象所共有的相同状态, 让你能在有限的内存容量中载入更多对象。

代理 代理 Proxy

让你能够提供对象的替代品或其占位符。 代理控制着对于原对象的访问, 并允许在将请求提交给对象前后进行一些处理。

继续阅读

适配器模式 

返回

 单例模式
RefactoringGuru
  • 会员专属内容
    • 深入设计模式
    • Refactoring Course
  • 设计模式
    • 目录
    • 创建型模式
      • 工厂方法模式
      • 抽象工厂模式
      • 生成器模式
      • 原型模式
      • 单例模式
    • 结构型模式
      • 适配器模式
      • 桥接模式
      • 组合模式
      • 装饰模式
      • 外观模式
      • 享元模式
      • 代理模式
    • 行为模式
      • 责任链模式
      • 命令模式
      • 迭代器模式
      • 中介者模式
      • 备忘录模式
      • 观察者模式
      • 状态模式
      • 策略模式
      • 模板方法模式
      • 访问者模式
    • 示例代码
      • C#
      • C++
      • Go
      • Java
      • PHP
      • Python
      • Ruby
      • Rust
      • Swift
      • TypeScript
  • 重构未翻译
    • What is Refactoring
      • Clean code
      • Technical debt
      • When to refactor
      • How to refactor
    • Catalog
    • Code Smells
      • Bloaters
        • Long Method
        • Large Class
        • Primitive Obsession
        • Long Parameter List
        • Data Clumps
      • Object-Orientation Abusers
        • Switch Statements
        • Temporary Field
        • Refused Bequest
        • Alternative Classes with Different Interfaces
      • Change Preventers
        • Divergent Change
        • Shotgun Surgery
        • Parallel Inheritance Hierarchies
      • Dispensables
        • Comments
        • Duplicate Code
        • Lazy Class
        • Data Class
        • Dead Code
        • Speculative Generality
      • Couplers
        • Feature Envy
        • Inappropriate Intimacy
        • Message Chains
        • Middle Man
      • Other Smells
        • Incomplete Library Class
    • Refactorings
      • Composing Methods
        • Extract Method
        • Inline Method
        • Extract Variable
        • Inline Temp
        • Replace Temp with Query
        • Split Temporary Variable
        • Remove Assignments to Parameters
        • Replace Method with Method Object
        • Substitute Algorithm
      • Moving Features between Objects
        • Move Method
        • Move Field
        • Extract Class
        • Inline Class
        • Hide Delegate
        • Remove Middle Man
        • Introduce Foreign Method
        • Introduce Local Extension
      • Organizing Data
        • Self Encapsulate Field
        • Replace Data Value with Object
        • Change Value to Reference
        • Change Reference to Value
        • Replace Array with Object
        • Duplicate Observed Data
        • Change Unidirectional Association to Bidirectional
        • Change Bidirectional Association to Unidirectional
        • Replace Magic Number with Symbolic Constant
        • Encapsulate Field
        • Encapsulate Collection
        • Replace Type Code with Class
        • Replace Type Code with Subclasses
        • Replace Type Code with State/Strategy
        • Replace Subclass with Fields
      • Simplifying Conditional Expressions
        • Decompose Conditional
        • Consolidate Conditional Expression
        • Consolidate Duplicate Conditional Fragments
        • Remove Control Flag
        • Replace Nested Conditional with Guard Clauses
        • Replace Conditional with Polymorphism
        • Introduce Null Object
        • Introduce Assertion
      • Simplifying Method Calls
        • Rename Method
        • Add Parameter
        • Remove Parameter
        • Separate Query from Modifier
        • Parameterize Method
        • Replace Parameter with Explicit Methods
        • Preserve Whole Object
        • Replace Parameter with Method Call
        • Introduce Parameter Object
        • Remove Setting Method
        • Hide Method
        • Replace Constructor with Factory Method
        • Replace Error Code with Exception
        • Replace Exception with Test
      • Dealing with Generalization
        • Pull Up Field
        • Pull Up Method
        • Pull Up Constructor Body
        • Push Down Method
        • Push Down Field
        • Extract Subclass
        • Extract Superclass
        • Extract Interface
        • Collapse Hierarchy
        • Form Template Method
        • Replace Inheritance with Delegation
        • Replace Delegation with Inheritance
登录 联系我们
RefactoringGuru
我的商店
  • English Español Français 日本語 한국어 Polski Português Brasileiro Русский Українська 中文
  • 联系我们
  • 登录
  • 主页
  • 重构
  • 设计模式
  • 会员专属内容
  • Git课程
  • 论坛
  • 联系我们
2014-2026 Refactoring.Guru. 版权所有。
图片作者: Dmitry Zhart
  • 条款与政策
  • 隐私政策
  • 内容使用政策
  • About us
Ukrainian office:
Organization address FOP Olga Skobeleva
Abolmasova 7
Kyiv, Ukraine, 02002
Email: support@refactoring.guru
Spanish office:
Organization address Oleksandr Shvets
Avda Pamplona 64
Pamplona, Spain, 31009
Email: support@refactoring.guru