上一页 1 ··· 15 16 17 18 19 20 21 22 23 ··· 37 下一页
该文被密码保护。 阅读全文
posted @ 2016-03-16 15:57 好好學習 阅读(29) 评论(0) 推荐(0)
摘要: 设计模式是软件开发讨论中,亘古不变的话题,今天又拿出来说道两句,也是对设计模式的一个复习吧。 工厂方法模式 工厂方法模型定义了一个用于创建对象的接口,让子类决定实例化哪一个类,工厂模式使一个类的实例化延迟到了其子类中。工厂方法模式是优化的简单工厂模式,它很好的支持了“开闭原则”。每一个具体的工厂只能 阅读全文
posted @ 2016-03-11 12:09 好好學習 阅读(337) 评论(0) 推荐(0)
摘要: 抽象工廠用例圖 代碼 class Program { static void Main(string[] args) { User user = new User(); Department dept = new Department(); IUser iu = DataAccess.CreateU 阅读全文
posted @ 2016-03-11 11:51 好好學習 阅读(153) 评论(0) 推荐(0)
摘要: 觀察者用例圖 代碼 class Program { static void Main(string[] args) { ConcreteSubject s = new ConcreteSubject(); s.Attach(new ConcreteObserver(s, "X")); s.Attac 阅读全文
posted @ 2016-03-11 11:50 好好學習 阅读(148) 评论(0) 推荐(0)
摘要: 建造者模式用例圖 代碼 class Program { static void Main(string[] args) { Director director = new Director(); Builder b1 = new ConcreteBuilder1(); Builder b2 = ne 阅读全文
posted @ 2016-03-11 11:48 好好學習 阅读(183) 评论(0) 推荐(0)
摘要: 外觀模式用例圖 外觀模式的基本代碼 class Program { static void Main(string[] args) { Facade facade = new Facade(); facade.MethodA(); facade.MethodB(); Console.Read(); 阅读全文
posted @ 2016-03-11 11:47 好好學習 阅读(165) 评论(0) 推荐(0)
摘要: 模板方法模式用例图 class Program { static void Main(string[] args) { AbstractClass c; c = new ConcreteClassA(); c.TemplateMethod(); c = new ConcreteClassB(); c 阅读全文
posted @ 2016-03-10 23:37 好好學習 阅读(184) 评论(0) 推荐(0)
摘要: 原型模式用例图 class Program { static void Main(string[] args) { Resume a = new Resume("大鸟"); a.SetPersonalInfo("男", "29"); a.SetWorkExperience("1998-2000", 阅读全文
posted @ 2016-03-10 23:18 好好學習 阅读(182) 评论(0) 推荐(0)
摘要: 工厂方法用例图 运算类及其实现方法 /// <summary> /// 运算类 /// </summary> class Operation { private double _numberA = 0; private double _numberB = 0; public double Numbe 阅读全文
posted @ 2016-03-10 23:13 好好學習 阅读(147) 评论(0) 推荐(0)
摘要: 代理模式用例图 class Program { static void Main(string[] args) { Proxy proxy = new Proxy(); proxy.Request(); Console.Read(); } } abstract class Subject { pub 阅读全文
posted @ 2016-03-10 23:04 好好學習 阅读(135) 评论(0) 推荐(0)
上一页 1 ··· 15 16 17 18 19 20 21 22 23 ··· 37 下一页