享元模式 - Flyweight Pattern
用途 節省記憶體和資源,並提高的效能 classDiagram ConcreteFlyweight ..|> IFlyweight UnsharedConcreteFlyweight ..|> IFlyweight Context ..> IFlyweight Context ..> Factory Factory ..> IFl...
用途 節省記憶體和資源,並提高的效能 classDiagram ConcreteFlyweight ..|> IFlyweight UnsharedConcreteFlyweight ..|> IFlyweight Context ..> IFlyweight Context ..> Factory Factory ..> IFl...
用途 提供了一個簡化的介面,用來操作複雜的子系統 classDiagram SystemFacade ..> SubsystemA SystemFacade ..> SubsystemB ClientA ..> SystemFacade ClientB ..> SystemFacade namespace System { cl...
用途 將操作從元素的類別中分離出來,並將其封裝在訪問者類別中 在不修改元素類別的情況下,可以輕鬆地新增新的操作或訪問者 classDiagram ConcreteVisitorA ..|> IVisitor ConcreteVisitorB ..|> IVisitor ConcreteElementA ..|> Element Concre...
用途 管理相依的觀察者,在被觀察對象發生變動發出通知觀察者 classDiagram note for Client "Create and register Observers, notify all observers when you need." Client ..> IObserver Client ..> ISubject IObserve...
用途 透過改變狀態來改變行為,讓每個狀態行為獨立易於添加、修改 classDiagram ConcreteStateA ..|> IState ConcreteStateB ..|> IState IState --o Context Client ..> Context note for Client "Create context the...
用途 管理物件狀態的存取 classDiagram note for Client "Originator modify content save to Memento\n MementoManager manage Memento" MementoManager --> Memento Originator --> Memento Client --...
用途 在演算法中替換一系列可能變動的部分 classDiagram IStrategy <|.. ConcreteStrategyA IStrategy <|.. ConcreteStrategyB Context *-- IStrategy note for Context "Execute -> do something with strat...
用途 透過代理控制對要訪問的物件加上一些額外的操作 classDiagram IEditor <|.. EditorProxy IEditor <|.. Writer EditorProxy --> Writer Client ..> IEditor class IEditor{ <<Interface>>...
用途 動態地往一個類別中添加新的行為 classDiagram IProduct <|.. Product IProduct <|-- AbstractDecorator IProduct --o AbstractDecorator AbstractDecorator <|-- ConcreteDecoratorA AbstractDecor...
用途 透過抽象工廠模式使客戶端程式碼與具體產品的實現解耦,提高程式碼的可擴展性和可維護性 classDiagram Client ..> IFactory Client ..> ProductA Client ..> ProductB ProductA <|-- FactoryAProductA ProductA <|-- Fac...