《設計模式——可複用物件導向軟體的基礎》學習筆記(1.2)Design patterns in Smalltalk MVC...
1.MVC
(1)Model: The application object;
(2)View: The screen presentation of the model;
(3)Controller: the way the user interface reacts the user input.
2.View and Model: decouple views and models
Establish a subscribe/notify protocol between views and models.
Subscribe: Update or create views without rewriting models.
Notify: Changing models will notify views that depend on them.
3.View and View: CompositeView: implemented as a complex view containing nested button views.
4.View and Controller: Encapsulate the response mechanism to user input in a Controller object.
(1)There is a hierarcy of controllers, making it easy to create a new controller a new controller as a variation on an existing one.
(2)A view uses an instance of a Controller subclass to implement a particular response strategy.
(3)To implement a different strategy, simply replace the instance with a different kind of controller.
(3)To change a view's controller at run-time.
5.Observer:
A design to applicable to a more general problem: decoupling objects so that changes to one can affect any number of others without requiring the changed object to know details of the others.
6.Composite:
A design to let programmers create a class hierarchy in which some subclasses define primitive objects and other classes define composite objects that assemble the primitives into more complex objects.
7.Strategy:
A Strategy is an object that represents an algorithm. It's useful when you want to replace the algorithm either statically or dynamically, when you have a lot of variants of the algorithm, or when the algorithm has complex data structures that you want to encapsulate.
9.Main relationships and other relationships in MVC
(1)Main relationships: Observer, Composite and Strategy.
(2)Other relationships: Factory and Decorator.
(1)Model: The application object;
(2)View: The screen presentation of the model;
(3)Controller: the way the user interface reacts the user input.
2.View and Model: decouple views and models
Establish a subscribe/notify protocol between views and models.
Subscribe: Update or create views without rewriting models.
Notify: Changing models will notify views that depend on them.
3.View and View: CompositeView: implemented as a complex view containing nested button views.
4.View and Controller: Encapsulate the response mechanism to user input in a Controller object.
(1)There is a hierarcy of controllers, making it easy to create a new controller a new controller as a variation on an existing one.
(2)A view uses an instance of a Controller subclass to implement a particular response strategy.
(3)To implement a different strategy, simply replace the instance with a different kind of controller.
(3)To change a view's controller at run-time.
5.Observer:
A design to applicable to a more general problem: decoupling objects so that changes to one can affect any number of others without requiring the changed object to know details of the others.
6.Composite:
A design to let programmers create a class hierarchy in which some subclasses define primitive objects and other classes define composite objects that assemble the primitives into more complex objects.
7.Strategy:
A Strategy is an object that represents an algorithm. It's useful when you want to replace the algorithm either statically or dynamically, when you have a lot of variants of the algorithm, or when the algorithm has complex data structures that you want to encapsulate.
9.Main relationships and other relationships in MVC
(1)Main relationships: Observer, Composite and Strategy.
(2)Other relationships: Factory and Decorator.
相關文章
- 設計模式:可複用物件導向軟體及基礎:4-7 物件行為模式:備忘錄模式(Memento)設計模式物件
- 程式設計基礎·Java學習筆記·物件導向(下)程式設計Java筆記物件
- (Java筆記)物件導向基礎Java筆記物件
- 菜鳥學習筆記:Java基礎篇1(基礎語法、物件導向)筆記Java物件
- [筆記]物件導向的程式設計筆記物件程式設計
- Python3:物件導向程式設計學習筆記(2)Python物件程式設計筆記
- C#學習筆記(六)——物件導向程式設計簡介C#筆記物件程式設計
- python基礎(物件導向程式設計)Python物件程式設計
- python物件導向程式設計基礎Python物件程式設計
- 【python 物件導向】 python物件學習筆記《1》Python物件筆記
- Python 3 學習筆記之——物件導向Python筆記物件
- Flutter學習筆記(8)--Dart物件導向Flutter筆記Dart物件
- Python學習筆記|Python之物件導向Python筆記物件
- js高階 物件導向 學習筆記JS物件筆記
- 【設計模式筆記】(零)- 物件導向的六大原則設計模式筆記物件
- JS物件導向設計模式JS物件設計模式
- 軟體設計師:物件導向技術物件
- 【JavaScript筆記 · 基礎篇(十)】物件導向程式設計之三:繼承機制JavaScript筆記物件程式設計繼承
- java基礎 韓順平老師的 物件導向(基礎) 自己記的部分筆記Java物件筆記
- C語言大型軟體設計的物件導向C語言物件
- 物件導向-設計模式-建立型物件設計模式
- Python學習之物件導向程式設計Python物件程式設計
- 物件導向筆記物件筆記
- js-物件導向-設計模式-命令模式JS物件設計模式
- JAVA物件導向基礎--物件導向介紹Java物件
- Python基礎入門(6)- 物件導向程式設計Python物件程式設計
- Java基礎-物件導向基礎Java物件
- 設計模式學習筆記設計模式筆記
- 學習筆記-設計模式筆記設計模式
- JavaScript-設計模式-物件導向程式設計JavaScript設計模式物件程式設計
- JavaScript設計模式之物件導向程式設計JavaScript設計模式物件程式設計
- Python物件導向基礎:設定物件屬性Python物件
- Python學習之路——類-物件導向程式設計Python物件程式設計
- 1.設計模式與物件導向設計模式物件
- 物件導向-設計模式-行為型物件設計模式
- 物件導向-設計模式-結構型物件設計模式
- 物件導向設計原則和模式物件模式
- Go語言結構體(struct)物件導向程式設計基礎篇Go結構體Struct物件程式設計
- Java零基礎學習之路(八)Java物件導向Java物件