.NET架构演化--从简单需求说起
2012-12-03 09:41
225 查看
因为渴求进步,所以分享我所理解的设计模式。同时也为了抛砖引玉,因为你我都需要成长!
客户需求1:请为我们电子商务网站的电子类产品计算价格,并打印显示出来.可能出现的一个实现版本代码如下:
View Code
View Code
View Code
View Code
View Code
View Code
View Code
View Code
View Code
View Code
View Code
View Code
View Code
View Code
View Code
客户代码调用:
View Code
客户需求1:请为我们电子商务网站的电子类产品计算价格,并打印显示出来.可能出现的一个实现版本代码如下:
View Code
View Code
View Code
View Code
View Code
View Code
View Code
View Code
View Code
1 public interface IGoodsFactory 2 { 3 Goods MakeMP4(); 4 Goods MakePad(); 5 Goods MakePhone(); 6 }
View Code
1 public interface IStore 2 { 3 IEnumerator CreateGoods(); 4 void Print(IEnumerator ienumerator); 5 }
View Code
public interface IStrategy { Double DisCounts { get; } }
View Code
View Code
View Code
View Code
1 protected override void Init() 2 { 3 Name = "Phone"; 4 Price = 4000; 5 DisCountsStrategy = new HalfPercentStrategy(); 6 }
客户代码调用:
View Code
1 static void Main(string[] args) 2 { 3 IStore store = new GoodsStore(new GoodsFactory()); 4 IEnumerator items = store.CreateGoods(); 5 store.Print(items); 6 }
相关文章推荐
- 业务、架构、技术,我们应该关注什么 Java和.Net的优势劣势简单看法 市场经济决定,商业之道即是软件之道,市场的需求决定着软件技术的发展 利益决定着选择应用新技术
- 架构从最简单的数据访问框架(ORM)到资源调度和治理中心(SOA)说起
- 基于.NET平台的分层架构实战(二)需求分析与数据库设计
- 简单.NET留言板架构
- .net中实现简单三层架构
- Unity V3 初步使用 —— 为我的.NET项目从简单三层架构转到IOC做准备
- Unity V3 初步使用 —— 为我的.NET项目从简单三层架构转到IOC做准备
- 利用XML配置实现增删改查的.net快速开发架构 简单的构建信息管理系统架构
- .NET 三层架构的简单规划
- Unity V3 初步使用 —— 为我的.NET项目从简单三层架构转到IOC做准备
- 分页控件的使用能不能再简单一点呢,能不能一个页面搞定所有的列表需求?
- 第一章 .Net 控件开发(WebForm) 开发简单自定义控件(2) 控件属性的申明
- 大型网站系统架构的演化
- 大型网站架构演化(二)——应用服务和数据服务分离
- .Net网站架构设计(八)测试
- 初次接触,简单的了解需求
- 16.淘宝的架构演化案例
- 1小时学会:最简单的iOS直播推流(二)代码架构概述
- 简单的实现.net中checkbox控件的单选!
- .net中创建一个简单的MVVM项目(1)