<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>设计模式 on 杨刚的个人网站</title>
    <link>https://www.ygang.top/tags/%E8%AE%BE%E8%AE%A1%E6%A8%A1%E5%BC%8F/</link>
    <description>Recent content in 设计模式 on 杨刚的个人网站</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>zh</language>
    <copyright>Copyright © 2018-2025 GradyYoung. All rights reserved.</copyright>
    <lastBuildDate>Wed, 14 May 2025 00:00:00 +0000</lastBuildDate><atom:link href="https://www.ygang.top/tags/%E8%AE%BE%E8%AE%A1%E6%A8%A1%E5%BC%8F/index.xml" rel="self" type="application/rss+xml" />
    
    <item>
      <title>1、单例模式</title>
      <link>https://www.ygang.top/posts/2d3150b2/6742e0c3/d6eeb5cd/</link>
      <pubDate>Wed, 14 May 2025 00:00:00 +0000</pubDate>
      
      <guid>https://www.ygang.top/posts/2d3150b2/6742e0c3/d6eeb5cd/</guid>
      <description>&lt;p&gt;单例模式（Singleton）确保一个类只有一个实例，并提供对该实例的全局访问点。&lt;/p&gt;</description>
      
    </item>
    
    <item>
      <title>1、代理模式</title>
      <link>https://www.ygang.top/posts/3ab7256e/6e08a29a/5d67f48c/cd17ae44/</link>
      <pubDate>Sat, 11 Nov 2023 00:00:00 +0000</pubDate>
      
      <guid>https://www.ygang.top/posts/3ab7256e/6e08a29a/5d67f48c/cd17ae44/</guid>
      <description>&lt;h2 class=&#34;relative group&#34;&gt;原理 
    &lt;div id=&#34;原理&#34; class=&#34;anchor&#34;&gt;&lt;/div&gt;
    
    &lt;span
        class=&#34;absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100&#34;&gt;
        &lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline&#34; href=&#34;#%e5%8e%9f%e7%90%86&#34; aria-label=&#34;锚点&#34;&gt;#&lt;/a&gt;
    &lt;/span&gt;        
    
&lt;/h2&gt;
&lt;p&gt;使用一个代理将对象包装起来, 然后用该代理对象取代原始对象。任何对原始对象的调用都要通过代理。代理对象决定是否以及何时将方法调用转到原始对象上。&lt;/p&gt;</description>
      
    </item>
    
    <item>
      <title>1、单例模式</title>
      <link>https://www.ygang.top/posts/3ab7256e/6e08a29a/16c47591/d6eeb5cd/</link>
      <pubDate>Sat, 11 Nov 2023 00:00:00 +0000</pubDate>
      
      <guid>https://www.ygang.top/posts/3ab7256e/6e08a29a/16c47591/d6eeb5cd/</guid>
      <description>&lt;h2 class=&#34;relative group&#34;&gt;要解决的问题： 
    &lt;div id=&#34;要解决的问题&#34; class=&#34;anchor&#34;&gt;&lt;/div&gt;
    
    &lt;span
        class=&#34;absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100&#34;&gt;
        &lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline&#34; href=&#34;#%e8%a6%81%e8%a7%a3%e5%86%b3%e7%9a%84%e9%97%ae%e9%a2%98&#34; aria-label=&#34;锚点&#34;&gt;#&lt;/a&gt;
    &lt;/span&gt;        
    
&lt;/h2&gt;
&lt;p&gt;所谓类的单例设计模式，就是采取一定的方法保证在整个的软件系统中，对某个类只能存在一个对象实例。&lt;/p&gt;</description>
      
    </item>
    
    <item>
      <title>1、设计模式概述</title>
      <link>https://www.ygang.top/posts/3ab7256e/6e08a29a/9beaf145/</link>
      <pubDate>Sat, 11 Nov 2023 00:00:00 +0000</pubDate>
      
      <guid>https://www.ygang.top/posts/3ab7256e/6e08a29a/9beaf145/</guid>
      <description>&lt;p&gt;&lt;strong&gt;设计模式&lt;/strong&gt;是在大量的实践中总结和理论化之后优的代码结构、编程风格、以及解决问题的思考方式。&lt;/p&gt;</description>
      
    </item>
    
    <item>
      <title>2、工厂模式</title>
      <link>https://www.ygang.top/posts/2d3150b2/6742e0c3/44fa6cdd/</link>
      <pubDate>Wed, 14 May 2025 00:00:00 +0000</pubDate>
      
      <guid>https://www.ygang.top/posts/2d3150b2/6742e0c3/44fa6cdd/</guid>
      <description>&lt;p&gt;工厂模式（Factory）提供了一种创建对象的接口，允许子类决定实例化的对象类型。在Go中，可以通过函数和接口实现工厂模式：&lt;/p&gt;</description>
      
    </item>
    
    <item>
      <title>2、装饰者模式</title>
      <link>https://www.ygang.top/posts/3ab7256e/6e08a29a/5d67f48c/65cc0218/</link>
      <pubDate>Sat, 11 Nov 2023 00:00:00 +0000</pubDate>
      
      <guid>https://www.ygang.top/posts/3ab7256e/6e08a29a/5d67f48c/65cc0218/</guid>
      <description>&lt;h2 class=&#34;relative group&#34;&gt;原理 
    &lt;div id=&#34;原理&#34; class=&#34;anchor&#34;&gt;&lt;/div&gt;
    
    &lt;span
        class=&#34;absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100&#34;&gt;
        &lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline&#34; href=&#34;#%e5%8e%9f%e7%90%86&#34; aria-label=&#34;锚点&#34;&gt;#&lt;/a&gt;
    &lt;/span&gt;        
    
&lt;/h2&gt;
&lt;p&gt;装饰者模式（DecoratorPattern）是指在不改变原对象的基础之上，将功能附加到对象上，提供了比继承更灵活性的替代方案（扩展原有对象的功能），装饰者模式属于结构型模式&lt;/p&gt;</description>
      
    </item>
    
    <item>
      <title>3、观察者模式</title>
      <link>https://www.ygang.top/posts/2d3150b2/6742e0c3/ffd954dd/</link>
      <pubDate>Wed, 14 May 2025 00:00:00 +0000</pubDate>
      
      <guid>https://www.ygang.top/posts/2d3150b2/6742e0c3/ffd954dd/</guid>
      <description>&lt;p&gt;观察者模式（Observer）定义了对象之间的一对多依赖关系，当一个对象状态改变时，所有依赖它的对象都会得到通知。在Go中，可以使用接口和切片实现观察者模式：&lt;/p&gt;</description>
      
    </item>
    
    <item>
      <title>4、策略模式</title>
      <link>https://www.ygang.top/posts/2d3150b2/6742e0c3/b3fb74f0/</link>
      <pubDate>Wed, 14 May 2025 00:00:00 +0000</pubDate>
      
      <guid>https://www.ygang.top/posts/2d3150b2/6742e0c3/b3fb74f0/</guid>
      <description>&lt;p&gt;策略模式（Strategy）定义了一系列算法，并使它们可以互相替换。在Go中，可以使用接口实现策略模式：&lt;/p&gt;</description>
      
    </item>
    
    <item>
      <title>5、适配器模式</title>
      <link>https://www.ygang.top/posts/2d3150b2/6742e0c3/13019dfb/</link>
      <pubDate>Wed, 14 May 2025 00:00:00 +0000</pubDate>
      
      <guid>https://www.ygang.top/posts/2d3150b2/6742e0c3/13019dfb/</guid>
      <description>&lt;p&gt;适配器模式（Adapter）允许不兼容的接口一起工作。在Go中，可以使用结构体嵌入和接口实现适配器模式：&lt;/p&gt;</description>
      
    </item>
    
  </channel>
</rss>
