随笔分类 - Design Pattern
摘要:Do we really need this design pattern? Just ignore, all the big guys requires it. For you, just understand the pattern and sleep over it.心得: 1. 确实存在的dependency只能被转移,不能被去除。 通过“转移”来降低coupling(耦合度)。 2. Inversion of control和dependency injection概念接近(don't call me, I will call you)。dependency
阅读全文
摘要:February 9th, 2005, 11:07 AM http://www.codeguru.com/forum/showthread.php?t=327982C++ Design Pattern: What is a Design Pattern? Q: What is a Design Pattern?A: Design Patterns represent solutions to pr...
阅读全文
摘要:[转载自:http://www.itisedu.com/phrase/200604231324325.html] MVC模式是"Model-View-Controller"的缩写,中文翻译为"模式-视图-控制器"。MVC应用程序总是由这三个部分组成。Event(事件)导致Controller改变Model或View,或者同时改变两者。只要Controller改变了Models的数据或者属性,...
阅读全文
摘要:[From: http://www.martinfowler.com/articles/injection.html] Forms of Dependency Injection The basic idea of the Dependency Injection is to have a separate object, an assembler, that populates a field...
阅读全文
摘要:[ 转自:http://www.contextfree.net/wangyw/index.html ] 作者:王咏武 在《道法自然——面向对象实践指南》一书中,我们采用了一个对立统一的辩证关系来说明“模板方法”模式—— “正向依赖 vs. 依赖倒置”(参见:《道法自然》第15章[王咏武, 王咏刚 2004])。这种把“好莱坞”原则和 “依赖倒置”原则等量齐观的看法其实来自于轻量级容器PicoCon...
阅读全文
摘要:[转载自:http://java.chinaitlab.com/others/20557.html] 一、什么是IOC IoC就是Inversion of Control,控制反转。在Java开发中,IoC意味着将你设计好的类交给系统去控制,而不是在你的类内部控制。这称为控制反转。 下面我们以几个例子来说明什么是IoC 假设我们要设计一个Girl和一个Boy类,其中...
阅读全文
摘要:Eric" Gamma说,要面向抽象编程。面向接口编程是面向对象的核心。防止 “everything depends on everything” 问题,即具体依赖于具体。 从GoF设计模式中,我们已经习惯一种思维编程方式:Interface Driven Design 接口驱动,接口驱动有很多好处,可以提供不同灵活的子类实现,增加代码稳定和健壮性等等,但是接口最终还是需要实现的,也就是如下语句...
阅读全文
摘要:设计模式学习:Observer模式 一、概述: DP一书对Observer模式意图的描述是:“定义对象间的一种一对多依赖关系,使得每当一个对象改变装态,则其相关依赖对象皆得到通知并自动更新。” 在软件的构建过程中,我们常常要为一些对象建立一种通知依赖关系:当一个对象(Subject)的状态发生改变或某一特定事件发生时,所有的依赖对象(Observer)都需要得到通知。由于需求的变化,...
阅读全文
摘要:Core: Refactor leads to the application of design pattern. No one, even "Gang of Four", can't decide which pattern to use at the beginning of a project. Software system is so changeable that it develo...
阅读全文
posted @ 2007-10-16 20:11
能巴

浙公网安备 33010602011771号