资源描述
Click to edit Title Slide,Click to edit Master text styles,Second level,Third level,Fourth level,Fifth level,Microsoft.NET,企业应用系统架构与设计模式,林耀珍,技术总监,第三波信息,Microsoft.NET,技術代言人,林耀珍,经历,第三波信息 技术总监,育碁数字科技 总经理,专业认证与专长,微软,.NET,技术,软件开发流程,信息系统规划,Microsoft MCSD/MCSE/MCDBA,对象导向技术,,Rational OOAD,认证讲师,Lotus Notes principle CLP/CLI,J2EE,大綱,前言,企业应用系统架构介绍,使用者接口设计模式,商业组件设计模式,数据组件设计模式与最佳实务,機會,軟體的需求持續成長,自動化,工業,商業,硬體加值,通訊,電視,家庭伺服器,數位內容,Beyond Data,Data,Doc,MM,人機介面,手寫,語音,more,對人力的需求龐大,精密複雜的工作,自動化程度低,挑戰,时间有限,经费有限,系统需求复杂,技术复杂,环境变化迅速,使用者心意不定,人力有限(数量与质量),With Less,Do More,威脅,全球化软件产业分工,全体软件开发工程师,800,万人,美国,印度,中国大陆,趨勢,硬件与通讯速度提升,价格下跌,功能强大的软件平台日益普及,Thanks To Microsoft and Other Vendors,全球化产业分工,icroTrend,Know-How,的累积与自动化,Domain Know-how,Process,Patterns,Architecture patterns,Design patterns,Coding template,Reusable Components,跨越鴻溝的橋樑,Architecture,Design and Process,Object Oriented/Component/Framework/Platform,Corner stone,大綱,前言,企業應用系統架構與,MVC,設計模式介紹,使用者介面設計模式,商業元件設計模式,資料元件設計模式與最佳實務,應用系統架構,Operational Management,Security,Communication,UI Components,UI Process Components,Data Access Components,Business Workflows,Business Components,Users,Business Entities,Service Agents,Service Interfaces,Data,Sources,Services,Patterns&Practices,Caching,Data Format&exchange,任何事物都有其架构,而且越简易越好,架构必须能够成长与调适,不然就要重建,應用系統架構,UI Components,:操作模式、数据安排、美观,User Process Components,:业务操作流程,Service Interfaces,:亦称为,Faade Layer,Business Components,:运算逻辑,Business Entities,:负责数据储存的组件,Business workflows,:跨系统服务的流程整合,Data Access logic Components,:存取数据库,Service Agents,:呼叫其它系统服务,建立程式架構,VS.NET Solution,MVC,Design Paradigm,问题,:,传统的程序混合画面、画面流程、商业逻辑、与数据库存取等功能,违反模块化设计原则,解决方案,:,Model:,数据与商业逻辑,View:,展现资料的画面,Controller:,接受,user request,呼叫适当的,Model,执行工作,然后显示展现结果的画面,结果,模块分工明确,成为,design,的基本原则,应用广泛,例如增加,Data access,组件分离,Business object,与数据存取,MVC,設計原則,View,Controller,request,Data,do,choose view,Return result,User input,Model,Render,Data Access,Model:,数据与商业逻辑,View:,展现资料的画面,Controller:,接受,user request,呼叫适当的,Model,执行工作,然后显示展现结果的画面,Access,大綱,前言,企业应用系统架构介绍,设计使用者接口组件与设计模式,设计商业组件与设计模式,设计数据存取组件与设计模式,設計使用者介面元件,Operational Management,Security,Communication,UI Components,UI Process Components,Data Access Components,Business Workflows,Business Components,Users,Business Entities,Service Agents,Service Interfaces,Data,Sources,Services,Patterns&Practices,Caching,Data Format&exchange,Application Architecture is the most important design pattern.,Front Controller,設計模式,适用于复杂的网站设计,允许动态设定,View,Navigation flow,Controller,优点,高度模块化,大幅降低重复的程序代码,集中,Business logic,与,Data access,适合对,Controller,BO,DO,做单元测试,可协调,multiple view,串联互动,弹性应用,Logical view,与,Physical view,缺点,复杂,动态产生对象损失效能,,Cache,可降低痛苦,User Interface Process Application Block,目标:建立简明、具延展性的,UIP,架构,需求:,多层式应用程序架构,适用于,Windows client,、,Web client,、,devices,可以储存使用者状态,可调整,UI,流程,但不必修改,code,设计要点,不同的,Client,端使用一致的程序模式,分离,UI Navigation flow,与,UI Components(form/page),分离,State management,与,UI Components,UIP Application Block,设计,Views,与,Navigation flow,Add to Cart,Catalog,Checkout,设定,Navigation flow,.,UIP,設計模型,Configuration File,Business entity-DataSet,Navigation,當,Initialize controller,時設定,Navigate()handler,設計,Controller,Controller,协调,Views,,,BO,,,DO,与,UIP Framework,Client agent,設計模式,統一,Windows/Web Form,存取,Business components,的服務介面,Isolate presentation layer from service changes,agent,大綱,前言,企业应用系统架构介绍,设计使用者接口组件与设计模式,设计商业组件与设计模式,设计数据存取组件与设计模式,設計商業元件,Operational Management,Security,Communication,UI Components,UI Process Components,Data Access Components,Business Workflows,Business Components,Users,Business Entities,Service Agents,Service Interfaces,Data,Sources,Services,Patterns&Practices,Caching,Data Format&exchange,Application Architecture is the most important design pattern.,規劃,Business Objects,的功能,从需求分析规划系统功能,并指派功能给适当的商业组件,功能需求,登入,浏览产品目录,加入物品至购物车,数量固定为,1,检视购物车内容,Check out order,显示,checkout,结果,非功能性需求,对密码加密,Business Entity,的型式,DataReader,:具有最快的读取速度,用于,Forward-ReadOnly,的场合,不具有,OO,概念,Generic DataSet,:,On-Memory database,Typed DataSet,:兼具有,Generic DataSet,的优点与对象导向程序设计的优点,多一些,overhead,XML,:可于执行查询直接传回,XmlReader,,或由,DataSet,做数据转换,Business entity class,:最符合对象导向程序概念,程序逻辑简单,但数据转型的,overhead,最大。处理大量或复杂的,related entities,时,必须小心处理以满足效能要求,設計,Business Entity,設計,DataSet,CartDS,CategoryDS,ProductDS,CustomerDS,設計,Business Rule Component,Facade,Service interface,設計模式,Faade design pattern,目标:子系统提供单一接口给客户端,问题:子系统内的,class,分别提供部分功能,客户端必须呼叫个别的,class,,致使两层间连结复杂,不易维护,违反,Encapsulation,原则,效果:简化设计,易于维护,Faade layer&Client Agent,Agent,Svc-2,UI Components,UI Process Components,Business Components,Business Entities,Service Interfaces,Svc-3,Svc-1,Faade layer,Web service,Windows/Web/PDA/Mobile Client,Remotable Component,Serviced Component,UDDI,discover,publish,Client,HTTP,TCP,Remoting,COM+,Client,TCP,DCOM,Business Logic,建立高可再用性的商業元件,HTTP,SOAP,WSDL,Add Web service,Add an ASP.NET Web service project,Add ref to businessFacade,common,Asmx delegates request to businessFacade,The quickest way,Copy codes from ClientAgent.cs,Add WebMethod for each method,大綱,前言,企业应用系统架构介绍,设计使用者接口组件与设计模式,设计商业组件与设计模式,设计数据存取组件与设计模式,設計資料存取元件,Operational Management,Security,Communication,UI Components,UI Process Components,Data Access Components,Business Workflows,Business Components,Users,Business Entities,Service Agents,Service Interfaces,Data,Sources,Services,Patterns&Practices,Caching,Data Format&exchange,設計資料存取元件,影响效能的关键之一,使用,Object/Component,进行设计符合自然的思考模式,RDB,的原理为集合运算,(Set),当大量的数据储存,RDBMS,时,必须将单次的大量运算移至数据端进行批次运算,但若是对大量数据进行多次运算,则应将之移入程序,AddOrder,组件,設計資料存取元件的考量因素,数据必须在各层组件中传递,所以需要,Serializable,考虑存取频率与数据量,考虑,read-only,或,mutable,是否需要,Cache,Business entity,与,table schema,不一定相同,存取大量数据或大量同时上线作业时必须有良好的效率,是否提供存取,XML,数据的功能,,esp.,在跨平台或系统整合时的需求,在,Client,端是否必须安装,及最佳的安装方法为何?,符合对象导向概念的数据组件,使程序单纯化,且可做编译时的型态检查,减少错误机会,最佳實務,(Best Practices),尽量减少数据组件的型态,简化开发及维护,如果数据以档案方式储存,应使用,xml,格式,Data Access,组件采用,stateless,模式,每一个,Data Access,组件一次只存取一个数据来源,Data Access,组件不可呼叫其它的,Data Access,组件,Data Access,组件对应,business Component,,不是对应,Table,Data Access,组件使用,stored procedures,与,RDB,沟通,Data Access,组件不处理,Transaction,使用,Connection-oriented object,时,必须尽速取出数据后释放,connection.,大量数据的批次作业,可避开对象导向程序处理模式,Data Access Application Block,目标:减少重复的程序代码,需求:,.NET Framework v1.1&ADO.NET,呼叫,Sql Statement,或,Store procedure,传回,void,int,DataReader,DataSet,XmlReader,设计要点,从,DB,撷取,Parameters,并,Cache Parameter set,可以设定,Transaction,Data Access Application Block,Data Access Application Block,Data Access Component,SQL Server,SqlHelper,ExecuteNonQuery,SqlHelperParameterCache,ExecuteDataset,ExecuteReader,ExecuteScalar,ExecuteXmlReader,CacheParameterSet,GetCachedParameterSet,GetSpParameterSet,int,DataSet,SqlDataReader,object,XmlReader,SqlParameter,Transact-SQL,or,Stored Procedure,實作,Data Access Object,自行设计或使用使用,Data Application Block,reader=,SqlHelper.ExecuteReader(this.connectionString,CommandType.StoredProcedure,SelectProductById,new SqlParameter new SqlParameter(ProductID,productId);,SqlHelperExtension.Fill(reader,productDS,product,0,1);,sqlConnection1=new SqlConnection();,sqlCommand1=new SqlCommand();,sqlConnection1.ConnectionString=this.connectionString;,sqlCommand1.CommandText=dbo.SelectProductById;,sqlCommand1.CommandType=CommandType.StoredProcedure;,sqlCommand1.Connection=this.sqlConnection1;,sqlCommand1.Parameters.Add(new SqlParameter(RETURN_VALUE,.,sqlCommand1.Parameters.Add(new SqlParameter(ProductID,.,總結,遵循,.NET,应用程序架构,善用,.NET Framework,运用适当的软件开发流程,For team-work project,选择适当的,Design Patterns,设计具有弹性的架构,Key to reuse,The Open-Closed Principle,Open For Extension,Closed For Modification,相關場次,.NET,应用程序效能调教与安全典范,分布式应用程序设计典范,Part I,II,如何透过,Web service,建立异质平台的互通性,深入,.NET Web service,探索,Web Service Enhancements 2.0,J2EE vs.NET Enterprise Services,final thoughts,2003 Microsoft Corporation.All rights reserved.,This presentation is for informational purposes only.MICROSOFT MAKES NO WARRANTIES,EXPRESS OR IMPLIED,IN THIS SUMMARY.,
展开阅读全文