You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
策略模式(Strategy),模板方法模式(Template Method),觀察者模式(Observer),迭代子模式(Iterator),責任鏈模式(Chain of Responsibility),命令模式(Command),備忘錄模式(Memento),狀態模式(State),訪問者模式(Visitor),中介者模式(Mediator),解釋器模式(Interpreter)。
https://codepen.io/collection/nYebQp
上方連結收錄了基本的23個Design Pattern,因為Design Pattern並不好讀,加上要原封不動地置入自己的專案中有點難,所以我覺得學習其中的設計精神與實際應用案例應該就夠用了,但是Design Pattern真的太難讀啦!所以我整理了一些較簡單的Javascript Sample Code跟說明在這邊,希望可以幫助到想學Design Pattern的人。
總體來說設計模式分為3大類:
創建型模式,共5種:
工廠方法模式(Factory Method),抽象工廠模式(Abstract Factory),單例模式(Singleton),建造者模式(Builder),原型模式(Prototype)
結構型模式,共7種:
適配器模式(Adapter),裝飾器模式(Decorator),代理模式(Proxy),外觀模式(Facade),橋接模式(Bridge),組合模式(Composite),享元模式(Flyweight)
行為型模式,共11種:
策略模式(Strategy),模板方法模式(Template Method),觀察者模式(Observer),迭代子模式(Iterator),責任鏈模式(Chain of Responsibility),命令模式(Command),備忘錄模式(Memento),狀態模式(State),訪問者模式(Visitor),中介者模式(Mediator),解釋器模式(Interpreter)。
==================================================================
參考資料:
The text was updated successfully, but these errors were encountered: