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. delphi 开发者 linux 实务(转)

    Linux Essentials for Delphi Developers   There is currently no way using Delphi to target Linux. Lon ...

  2. XidianOJ 1087 浪漫的V8

    题目描述 V8为了讨女朋友开心,给lx承包大活后面那个水塘.为了筹集资金,V8偷偷地溜进了一座古墓,发现在他面前有金光闪闪的若干小箱子,里面全都是金粉,作为横行于各种@#¥&场所的V8来说,辨 ...

  3. sql join用法学习

    为了在两个或更多的表中获取结果,我们常常会用到join inner join(又叫join) out join包括left join,right join和full join(也就是left+righ ...

  4. CloudStack系统部署系列教程-KVM

    之前培训时获得的资料,以防丢失,故发布此以做备份.

  5. easyui datagrid 没数据时显示滚动条的解决方法

    今天解决了一个bug,因为datagrid有多列,可是当没有数据的时候,后面的列无法通过滚动条拉动来显示,比较麻烦,而需求要求没有数据也要拉动滚动条查看后面有什么列,一开始在网上找了一些资料,发现都不 ...

  6. jquery实现幻灯片

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...

  7. shell 统计某个文件的行数命令

    语法:wc [选项] 文件- 说明:该命令统计给定文件中的字节数.字数.行数.如果没有给出文件名,则从标准输入读取.wc同时也给出所有指定文件的总统计数.字是由空格字符区分开的最大字符串. 该命令各选 ...

  8. 1.springMVC+spring+Mybatis的整合思路

    SSM整合的过程:就是把一些东西交给spring管理,也就是添加配置文件的一个过程.那么有哪些东西我们要交给spring管理呢?大概有以下几个: 1.数据源(可配置数据库连接池) 2.SqlSessi ...

  9. jQuery:提交表单前判断表单是否被修改过

    表单加载完成后执行 : //表单中包含input(text,checkbox,hidden),select,radio,   $("#editWithdrawAutoApprovedConf ...

  10. Linux课程实践三:简单程序破解

    一.基本知识 1. 常用指令机器码 不同版本对应机器码不同,这里以我做实验的kali(Intel 80386)为例. 指令 作用 机器码 nop 无作用(no operation) 90 call 调 ...