Design Pattern
2020-05-20 17:37:00 0 举报
23种设计模式。逐步更新中。
作者其他创作
大纲/内容
Demo
+ Run();
INotify
+Update()
ConcreteProduct2B
+ Operation1();+ Operation2();
IStrategy
+Algorithm();
ConcreteProductA
IComponent
+Operation()
ConcreteProductB
ConcreteBuilder2
+ Property;
# BuilderStep1();# BuilderStep2();# BuilderStep3();
4. Decoator Pattern
4. Sample Factory Pattern
FactoryDemo
+ Property
+ CreateConcretePA();+ CreateConcretePB();
Decorator:: Opeartion();AddedBehavior;The Compoent comes in ctor;The componet is polymorphic and its operation is point to its concrete operation
IProduct
Decorator
+ Component
IBuilder
+ BuilderStep1();+ BuilderStep2();+ BuilderStep3();
1. Template Pattern
Factory
+ CreateProduct();
Circle
- Type;
+ Clone();
ConcreteProduct2A
ConcreteNotifyA
6. Prototype Pattern
5. Abstract Factory Pattern
ConcreteFactoryA
The Run method will create different ConcreteClassA or B and to do their father's Operation. The result according to the different implementation.
7. Builder Pattern
ConcreteSubject
+Operator();
ConcreteStrategyA
ConcreteClassA
- Override Step2();- Override Step4();
combination
BuilderDemo
+ CreateObject();
ConcreteComponent
IProduct1
ConcreteProduct1A
+Context context
+Operate();
ConcreteNotifyB
Context
+IStrategy Strategy
+ExecuteAlgorithm()
3. Observer Pattern
IShape
+ Type;
ConcreteProduct1B
ConcreteDecoratorA
+Operation()+AddedState()
Rectangle
ConcreteClassB
2. Strategy Pattern
ConcreteDecoratorB
+Operation()+AddedBehavior()
AbstractFactory
Director
- Builder;
+ BuilderConstructor()
ConcreteBuilder1
AbstractClass
- Step1();# Abstract Step2();- Step3();# Abstract Step4();+Operation();
ConcreteStrategyB
Component->Operation
PrototypeDemo
+ GetShapeClone();
AbstractSubject
+ List<INotify> Notifies
+AddNotify(INotify);+RemoveNotify(INotify);+Operations();+OnNotify();
AbstractFactoryDemo
+ CreateConcreteFA();+ CreateConcreteFB();
IProduct2
收藏
0 条评论
下一页