<<Design Patterns>> Gang of Four
One:Introduction:
One-1:Before delving into the some twenty pattern designs, it's necessary for ME(not for all readers) to get at some philosophies of OOD/OOP.
(1)Requests are the only way to get an object to execute an operation and Operations are the only way to change an object's internal data(state).this might appears going without saying,but I think it's important to kept in mind when programming.
(2)Interfaces of an object are preferably suggested to interact with the object's own data. I get this sense in practice. For example, the class Image, aggregates a

class Feature. when implementing interfaces in class Image, I'd better only deal with feature itself instead of letting Image's interfaces visit feature's data derecty.
(2)MVC使用了什么设计模式?
首先是观察者模式。其通过建立subscribe/notify机制,施加于view和model之间。当model里面的数据改变的时候,model应该通知依赖于这个model的所有views;然后每个view就更新自己。这个方法可以使“多个view依赖一个model时候,想创建一个新的依赖于此model的view“的时候使用。这样可以不重写这个model。
其次是组合模式。当一个view里面包含其他view,比如一个panel里面包含button,text等。这个nested views可以作为view的子类,可以用在任何父类被使用的地方。并作为一个整体被外部访问。
还有就是策略模式,其可以施加与view-controller之间。一个view使用一个controller的实例,每当view改变的时候(这里的改变包括很多,比如view的外观改变,行为改变(比如拒绝接受用户的输入等)等),对一个controller实例可以对其进行控制。
当然,MVC还可以使用工厂方法,装饰模式。前者可以为一个view生产指定的或默认的controller,后者可以给一个view添加scrolling。
<<Design Patterns>> Gang of Four的更多相关文章
- MapReduce Design Patterns(chapter 1)(一)
Chapter 1.Design Patterns and MapReduce MapReduce 是一种运行于成百上千台机器上的处理数据的框架,目前被google,Hadoop等多家公司或社区广泛使 ...
- Design Patterns Example Code (in C++)
Overview Design patterns are ways to reuse design solutions that other software developers have crea ...
- (转)MapReduce Design Patterns(chapter 1)(一)
翻译的是这本书: Chapter 1.Design Patterns and MapReduce MapReduce 是一种运行于成百上千台机器上的处理数据的框架,目前被google,Hadoop等多 ...
- How I explained Design Patterns to my wife: Part 1
Introduction Me and my wife had some interesting conversations on Object Oriented Design principles. ...
- Design Patterns Uncovered: The Chain Of Responsibility Pattern
Chain of Responsibility in the Real World The idea of the Chain Of Responsibility is that it avoids ...
- 图书-软件架构:《Design Patterns: Elements of Reusable Object-Oriented Software》(即后述《设计模式》一书)
ylbtech-图书-软件架构:<Design Patterns: Elements of Reusable Object-Oriented Software>(即后述<设计模式&g ...
- Design Patterns Simplified - Part 3 (Simple Factory)【设计模式简述--第三部分(简单工厂)】
原文链接:http://www.c-sharpcorner.com/UploadFile/19b1bd/design-patterns-simplified-part3-factory/ Design ...
- Design Patterns Simplified - Part 2 (Singleton)【设计模式简述--第二部分(单例模式)】
原文链接: http://www.c-sharpcorner.com/UploadFile/19b1bd/design-patterns-simplified-part-2-singleton/ De ...
- Head First Design Patterns
From Head First Design Patterns. Design Principle: Idnetify the aspects of your application that var ...
随机推荐
- 获取系统进程信息和进程依赖的dll信息
body { font-family: Bitstream Vera Sans Mono; font-size: 11pt; line-height: 1.5; } html, body { colo ...
- CubieTruck上安装mjpg_streamer
最近手头项目需要用到一个上位机,需要在上位机上实现远程访问及视频监控.其中视频监控采用了网上资料较多的mjpg_streamer进行视频处理.在使用中遇到许多坑也一并记录下来. 首先安装依赖环境和检测 ...
- devexpress bandgridview使用总结(14.2)
这两天利用bandgridview做表头,希望做成如下形状 在制作过程中发现如果想实现动态表头,代码的书写顺序需要稍加注意 实例化gridband 绑定gridband至bandgridview gr ...
- 回车与换行 ---编码等相关讨论----由notepad++ 批量替换 引发的讨论,转义字符也是人为硬性规定的。
,
- EM算法(2):GMM训练算法
目录 EM算法(1):K-means 算法 EM算法(2):GMM训练算法 EM算法(3):EM算法运用 EM算法(4):EM算法证明 EM算法(2):GMM训练算法 1. 简介 GMM模型全称为Ga ...
- C# 获取系统时间及时间格式
--DateTime 数字型 System.DateTime currentTime=new System.DateTime(); 取当前年月日时分秒 currentTime=System. ...
- DataSnap修改数据ApplyUpdates出现错误:连接繁忙导致另一个命令
最近准备尝试用DBExpress做个SQL Serer应用,在学习的时候发现一个问题使用DBExpress连接Sql server 2008 express使用以下控件SQLConnection-&g ...
- 开源GIS软件初探
谈到GIS软件,首先让我们想到的便是GIS界的龙头大哥ESRI公司旗下的ArcGIS产品,从最初接触的version 9.2到如今的version 10.1,其发展可谓风生水起.MapInfo软件也不 ...
- 关于NIO
操作系统的IO控制 在整个IO控制方式的发展过程中,始终贯穿着这样一条宗旨:即尽量减少主机对IO控制的干预,把主机从繁杂的IO控制事务中解脱出来,以便更多地去完成数据处理任务.为了缓和高速CPU和IO ...
- C++的一些小的知识点
1.初始化: 对于内置类型 ]; // 10个未初始化int ](); // 10个值初始化为0的int 对于自定义类型: 只要一调用new,那么编译器不仅仅给它分配内存,还调用它的默认构造函数初始化 ...