《設計模式——可複用物件導向軟體的基礎》學習筆記(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.
相關文章
- 《設計模式——可複用物件導向軟體的基礎》學習筆記(1.4)The catalog of design patterns...設計模式物件筆記
- 《設計模式——可複用物件導向軟體的基礎》學習筆記(1.3)Describing design patterns...設計模式物件筆記
- 《設計模式——可複用物件導向軟體的基礎》學習筆記(1.1)What is a design pattern?...設計模式物件筆記
- 《設計模式——可複用物件導向軟體的基礎》學習筆記(1.5)Organizing the catalog...設計模式物件筆記
- 設計模式:可複用物件導向軟體及基礎:4-7 物件行為模式:備忘錄模式(Memento)設計模式物件
- 程式設計基礎·Java學習筆記·物件導向(下)程式設計Java筆記物件
- 設計模式(Design Patterns)筆記 (轉)設計模式筆記
- 為什麼要學習設計模式(Design Patterns) - 軟體設計大師之路 (轉)設計模式
- (Java筆記)物件導向基礎Java筆記物件
- 設計模式(Design Patterns)筆記之一:Abstract Factory (轉)設計模式筆記
- 設計模式(Design Patterns)筆記之二:Adapter (轉)設計模式筆記APT
- 設計模式(Design Patterns)筆記之三:Bridge (轉)設計模式筆記
- 菜鳥學習筆記:Java基礎篇1(基礎語法、物件導向)筆記Java物件
- [筆記]物件導向的程式設計筆記物件程式設計
- 為什麼要學習設計模式(Design Patterns) - 怎樣成為軟體設計大師 (轉)設計模式
- 【軟體工程】物件導向的設計軟體工程物件
- Lua學習筆記--物件導向(三)筆記物件
- C#學習筆記(六)——物件導向程式設計簡介C#筆記物件程式設計
- Python3:物件導向程式設計學習筆記(2)Python物件程式設計筆記
- 學習筆記:物件導向程式設計技術(C++版)筆記物件程式設計C++
- [.net 物件導向程式設計基礎] (2) 關於物件導向程式設計物件程式設計
- Flutter學習筆記(8)--Dart物件導向Flutter筆記Dart物件
- js高階 物件導向 學習筆記JS物件筆記
- Ext學習筆記2-物件導向筆記物件
- python物件導向程式設計基礎Python物件程式設計
- python基礎(物件導向程式設計)Python物件程式設計
- java基礎 韓順平老師的 物件導向(基礎) 自己記的部分筆記Java物件筆記
- JS物件導向設計模式JS物件設計模式
- 軟體設計師:物件導向技術物件
- 【設計模式筆記】(零)- 物件導向的六大原則設計模式筆記物件
- Javascript設計模式讀書筆記一 JAVASCRIPT物件導向的實現JavaScript設計模式筆記物件
- Python 3 學習筆記之——物件導向Python筆記物件
- 【python 物件導向】 python物件學習筆記《1》Python物件筆記
- [.net 物件導向程式設計基礎] (19) LINQ基礎物件程式設計
- <<軟體設計學習筆記>> (轉)筆記
- 我學設計模式 之 物件導向設計原則設計模式物件
- [.net 物件導向程式設計基礎] (16) 介面物件程式設計
- [.net 物件導向程式設計基礎] (22) 事件物件程式設計事件