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的更多相关文章

  1. MapReduce Design Patterns(chapter 1)(一)

    Chapter 1.Design Patterns and MapReduce MapReduce 是一种运行于成百上千台机器上的处理数据的框架,目前被google,Hadoop等多家公司或社区广泛使 ...

  2. Design Patterns Example Code (in C++)

    Overview Design patterns are ways to reuse design solutions that other software developers have crea ...

  3. (转)MapReduce Design Patterns(chapter 1)(一)

    翻译的是这本书: Chapter 1.Design Patterns and MapReduce MapReduce 是一种运行于成百上千台机器上的处理数据的框架,目前被google,Hadoop等多 ...

  4. How I explained Design Patterns to my wife: Part 1

    Introduction Me and my wife had some interesting conversations on Object Oriented Design principles. ...

  5. 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 ...

  6. 图书-软件架构:《Design Patterns: Elements of Reusable Object-Oriented Software》(即后述《设计模式》一书)

    ylbtech-图书-软件架构:<Design Patterns: Elements of Reusable Object-Oriented Software>(即后述<设计模式&g ...

  7. Design Patterns Simplified - Part 3 (Simple Factory)【设计模式简述--第三部分(简单工厂)】

    原文链接:http://www.c-sharpcorner.com/UploadFile/19b1bd/design-patterns-simplified-part3-factory/ Design ...

  8. Design Patterns Simplified - Part 2 (Singleton)【设计模式简述--第二部分(单例模式)】

    原文链接: http://www.c-sharpcorner.com/UploadFile/19b1bd/design-patterns-simplified-part-2-singleton/ De ...

  9. Head First Design Patterns

    From Head First Design Patterns. Design Principle: Idnetify the aspects of your application that var ...

随机推荐

  1. AngularJS 2 VS Code Linter环境设置

    Angular Cli npm install -g angular-cli https://www.npmjs.com/package/angular-cli TSLinter 1.1 ext in ...

  2. .NET (上传的)文件下载

    string strPath = “//UploadFiles/Equipment/QQ截图.png” // 文件有效地址 FileInfo fileInfo = new FileInfo(strPa ...

  3. 博客CSS

    <p style="background: #CFE0F8; padding: 5px;">理解Code First及其约定和配置</p> <p id ...

  4. 经典功率谱估计及Matlab仿真

    原文出自:http://www.cnblogs.com/jacklu/p/5140913.html 功率谱估计在分析平稳各态遍历随机信号频率成分领域被广泛使用,并且已被成功应用到雷达信号处理.故障诊断 ...

  5. iOS图片加载到内存中占用内存情况

    我的测试结果: 图片占用内存   图片尺寸           .png文件大小 1MB              512*512          316KB 4MB              10 ...

  6. Python全栈开发day7

    一.Python生成器/迭代器 1 2 3 4 5 6 7 8 9 10 11 12 #!/bin/env python # -*- coding:utf-8 -*- def shaw(n):     ...

  7. 最简单的JS图片轮播

    var arr=new Array(); arr[1]="";//放图片地址 arr[2]=""; arr[3]=""; var no=0; ...

  8. ng-style 的坑 - 对性能的影响

    本文地址:http://www.cnblogs.com/jying/p/5633203.html 熟悉 angular 的前端对ng-style 一定不陌生,这个家伙可以绑定一个函数,使得我们可以在函 ...

  9. sql server2008 字段类型

    bit    整型 bit数据类型是整型,其值只能是0.1或空值.这种数据类型用于存储只有两种可能值的数据,如Yes 或No.True 或False .On 或Off. 注意:很省空间的一种数据类型, ...

  10. iOS开发 代码 或 <Home+Power>截屏

      1. 截屏的两种简单方法, 注意这两种截图方法,都必须在视图完全加载完成后才能截图,即在 viewDidAppear 方法之后截屏,否则无法得到想要的截屏效果 (1) 利用绘图方法 renderI ...