摘要: 处理一个剪贴板之类的部分控件模块之间的关系,如选定一部分文本按撤消按钮或者按菜单兰里面的部分功能,他们之间都是相关的,如下有两种做法:[代码]运用中介者设计模式:[代码] 阅读全文
posted @ 2009-05-19 21:50 愚蠢的笨蛋 阅读(178) 评论(0) 推荐(0) 编辑
摘要: 将大写的一组数字转换为阿拉伯数字:[代码] 阅读全文
posted @ 2009-05-15 21:21 愚蠢的笨蛋 阅读(125) 评论(0) 推荐(0) 编辑
摘要: 原始紧耦合的代码:[代码]一种做法:[代码]Command命令模式的做法:[代码] 阅读全文
posted @ 2009-05-15 18:55 愚蠢的笨蛋 阅读(168) 评论(0) 推荐(0) 编辑
摘要: 经典台词:“不要调用我,让我来调用你。”框架撰写者写好虚方法,留给应用程序开发人员,将虚方法的调用写在框架中,留给客户程序去重写。调用的时候直接传相应的对象就可以了框架程序代码:[代码]应用程序代码:[代码] 阅读全文
posted @ 2009-05-13 20:18 愚蠢的笨蛋 阅读(124) 评论(0) 推荐(0) 编辑
摘要: [代码] 阅读全文
posted @ 2009-05-12 14:35 愚蠢的笨蛋 阅读(511) 评论(0) 推荐(0) 编辑
摘要: Flyweight享元模式是避免系统过多出现重复实例,同样的对象公用一个元,如下图所示: 以一个系统中一个文档中,有很多字,每个字有相应的字体,如果对每个字设置字体就如箭头前的模式.箭头后面是Flyweight模式结构,代码如下: Flyweight Code highlighting produced by Actipro CodeHighlighter (freeware)http:... 阅读全文
posted @ 2009-05-09 13:48 愚蠢的笨蛋 阅读(139) 评论(0) 推荐(0) 编辑
摘要: 读/facid/是法文 facade Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--> internal class Wheel { public void WAction1() { } public void WAction2() ... 阅读全文
posted @ 2009-05-06 17:30 愚蠢的笨蛋 阅读(95) 评论(0) 推荐(0) 编辑
摘要: 给T50型坦克加上,夜视,两栖,卫星定位等拓展功能 sufferedWay... old Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->//传统的做法 //每一种需要扩展的坦克型号都需要写一个新的更加复杂的类 public class Tank {... 阅读全文
posted @ 2009-05-05 16:47 愚蠢的笨蛋 阅读(144) 评论(0) 推荐(0) 编辑
摘要: 原始耦合度较高的操作方式: old Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->using System.Collections; public interface IBox { void process(); } public clas... 阅读全文
posted @ 2009-05-03 22:11 愚蠢的笨蛋 阅读(159) 评论(0) 推荐(0) 编辑
摘要: 做一个"坦克大战"的游戏,在手机上和PC上同时实现: 传统的实现方式: oldSchool Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->public abstract class Tank { public abstract void Sh... 阅读全文
posted @ 2009-05-02 20:50 愚蠢的笨蛋 阅读(172) 评论(0) 推荐(0) 编辑