java設計模式詳解

來源:互聯網
上載者:User

標籤:res   可靠   stat   visit   comm   visitor   詳解   type   dia   

設計模式: 設計模式(Design Pattern)是一套被反覆使用、多數人知曉的、經過分類編目的、代碼設計經驗的總結,使用設計模式是為了可重用代碼、讓代碼更容易被他人理解並且保證代碼可靠性。

狹義的設計模式是指GoF在《設計模式:可複用物件導向軟體的基礎》一書中所介紹的23種經典設計模式,不過設計模式並不僅僅只有這23種,隨著軟體開發技術的發展,越來越多的新模式不斷誕生並得以應用。

設計模式可分為:建立型(Creational):建立型模式主要用於描述如何建立對象

                           結構型(Structural):主要用於描述如何?類或對象的組合

                           行為型(Behavioral):主要用於描述類或對象怎樣互動以及怎樣分配職責

                            5種建立型設計模式,7種結構型設計模式,11種行為型設計模式。

有一個設計模式雖然不屬於GoF 23種設計模式,但一般在介紹設計模式時都會對它進行說明,它就是簡單原廠模式,所以一共有24設計模式

類型                                                   模式名稱                                                   學習難度          使用頻率
建立型模式 Creational Pattern          單例模式 Singleton Pattern                       ★☆☆☆☆          ★★★★☆
建立型模式 Creational Pattern          Factory 方法模式 Factory Method Pattern      ★★☆☆☆          ★★★★★
建立型模式 CreationalPattern           抽象原廠模式 Abstract Factory Pattern     ★★★★☆           ★★★★★
建立型模式 Creational Pattern          原型模式 Prototype Pattern                       ★★★☆☆          ★★★☆☆
建立型模式 Creational Pattern          建造者模式 Builder Pattern                        ★★★★☆           ★★☆☆☆
結構型模式 Structural Pattern           適配器模式 Adapter Pattern                       ★★☆☆☆         ★★★★☆
結構型模式 Structural Pattern           橋接模式 Bridge Pattern                            ★★★☆☆          ★★★☆☆
結構型模式 Structural Pattern           組合模式 Composite Pattern                      ★★★☆☆         ★★★★☆
結構型模式 Structural Pattern           裝飾模式 Decorator Pattern                       ★★★☆☆           ★★★☆☆
結構型模式 Structural Pattern           面板模式 Façade Pattern                           ★☆☆☆☆          ★★★★★
結構型模式 Structural Pattern           享元模式 Flyweight Pattern                         ★★★★☆          ★☆☆☆☆
結構型模式 Structural Pattern          代理模式 Proxy Pattern                               ★★★☆☆           ★★★★☆
行為型模式 Behavioral Pattern         職責鏈模式 Chain of ResponsibilityPattern  ★★★☆☆          ★★☆☆☆
行為型模式 Behavioral Pattern         命令模式 Command Pattern                        ★★★☆☆          ★★★★☆
行為型模式 Behavioral Pattern         解譯器模式 Interpreter Pattern                    ★★★★★           ★☆☆☆☆
行為型模式 Behavioral Pattern         迭代器模式 Iterator Pattern                         ★★★☆☆           ★★★★★
行為型模式 Behavioral Pattern         中介者模式 Mediator Pattern                       ★★★☆☆          ★★☆☆☆
行為型模式 Behavioral Pattern         備忘錄模式 Memento Pattern                      ★★☆☆☆         ★★☆☆☆
行為型模式 Behavioral Pattern         觀察者模式 Observer Pattern                      ★★★☆☆          ★★★★★
行為型模式 Behavioral Pattern         狀態模式 State Pattern                                ★★★☆☆          ★★★☆☆
行為型模式 Behavioral Pattern         策略模式 Strategy Pattern                           ★☆☆☆☆          ★★★★☆
行為型模式 Behavioral Pattern         模板方法模式 Template Method Pattern      ★★☆☆☆          ★★★☆☆
行為型模式 Behavioral Pattern         訪問者模式 Visitor Pattern                           ★★★★☆          ★☆☆☆☆

java設計模式詳解

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.