根據(jù)設(shè)計(jì)模式的參考書 Design Patterns - Elements of Reusable Object-Oriented Software(中文譯名:設(shè)計(jì)模式 - 可復(fù)用的面向?qū)ο筌浖兀?中所提到的,總共有 23 種設(shè)計(jì)模式。這些模式可以分為三大類:創(chuàng)建型模式(Creational Patterns)、結(jié)構(gòu)型模式(Structural Patterns)、行為型模式(Behavioral Patterns)。當(dāng)然,我們還會(huì)討論另一類設(shè)計(jì)模式:J2EE 設(shè)計(jì)模式。
序號(hào) | 模式 & 描述 | 包括 |
---|---|---|
1 |
創(chuàng)建型模式 這些設(shè)計(jì)模式提供了一種在 創(chuàng)建對(duì)象的同時(shí)隱藏創(chuàng)建邏 輯的方式,而不是使用new 運(yùn)算符直接實(shí)例化對(duì)象。這 使得程序在判斷針對(duì)某個(gè)給 定實(shí)例需要?jiǎng)?chuàng)建哪些對(duì)象時(shí) 更加靈活。 |
- 工廠模式(Factory Pattern) - 抽象工廠模式(Abstract Factory Pattern) - 單例模式(Singleton Pattern) - 建造者模式(Builder Pattern) - 原型模式(Prototype Pattern) |
2 |
結(jié)構(gòu)型模式 這些設(shè)計(jì)模式關(guān)注類和對(duì)象 的組合。繼承的概念被用來(lái) 組合接口和定義組合對(duì)象獲 得新功能的方式。 |
- 適配器模式(Adapter Pattern) - 橋接模式(Bridge Pattern) - 過(guò)濾器模式(Filter、Criteria Pattern) - 組合模式(Composite Pattern) - 裝飾器模式(Decorator Pattern) - 外觀模式(Facade Pattern) - 享元模式(Flyweight Pattern) - 代理模式(Proxy Pattern) |
3 |
行為型模式 這些設(shè)計(jì)模式特別關(guān)注對(duì)象 之間的通信。 |
- 責(zé)任鏈模式(Chain of Responsibility Pattern) - 命令模式(Command Pattern) - 解釋器模式(Interpreter Pattern) - 迭代器模式(Iterator Pattern) - 中介者模式(Mediator Pattern) - 備忘錄模式(Memento Pattern) - 觀察者模式(Observer Pattern) - 狀態(tài)模式(State Pattern) - 空對(duì)象模式(Null Object Pattern) - 策略模式(Strategy Pattern) - 模板模式(Template Pattern) - 訪問(wèn)者模式(Visitor Pattern) |
4 |
J2EE 模式 這些設(shè)計(jì)模式特別關(guān)注表示層。 |
- MVC 模式(MVC Pattern) - 業(yè)務(wù)代表模式(Business Delegate Pattern) - 組合實(shí)體模式(Composite Entity Pattern) - 數(shù)據(jù)訪問(wèn)對(duì)象模式(Data Access Object Pattern) - 前端控制器模式(Front Controller Pattern) - 攔截過(guò)濾器模式(Intercepting Filter Pattern) - 服務(wù)定位器模式(Service Locator Pattern) - 傳輸對(duì)象模式(Transfer Object Pattern) |