电子文档交易市场
安卓APP | ios版本
电子文档交易市场
安卓APP | ios版本

软件设计模式(一)

65页
  • 卖家[上传人]:luoxia****01802
  • 文档编号:75498339
  • 上传时间:2019-01-31
  • 文档格式:PPT
  • 文档大小:419KB
  • / 65 举报 版权申诉 马上下载
  • 文本预览
  • 下载提示
  • 常见问题
    • 1、软件设计模式(一),潘爱民 http:/ Patterns?,内容,从一个例子看模式 关于模式的研究情况 介绍一些重要的模式(部分) 第三次作业,一个设计例子,VC/Samples/MFC/OLE/DrawCli,DrawCli的基础,MFC提供的基础 Doc/View结构 Doc提供了强大的数据管理功能 View提供了强大的显示功能 splitwnd功能 CWinApp/CMainFrame 提供了一套命令处理流程 对OLE的封装 Active Container OLE Clipboard Property Page 数据结构管理功能 CObject/CObList,我们的设计焦点,用C+对象来表示每一个图元 定义图元的公共接口 如何处理用户的操作 鼠标的动作 图元对象的创建和管理,图元基类,class CDrawObj : public CObject / Attributes CDrawDoc* m_pDocument; / owner virtual int GetHandleCount(); virtual CPoint GetHandle(int nHandle); vi

      2、rtual HCURSOR GetHandleCursor(int nHandle); virtual void SetLineColor(COLORREF color); virtual void SetFillColor(COLORREF color); / Operations virtual void Draw(CDC* pDC); virtual void DrawTracker(CDC* pDC, TrackerState state); virtual void MoveTo(const CRect,图元层次结构,CDrawObj CDrawRect CDrawPoly CDrawOleObj ,CDrawObj,CDrawRect,CDrawPoly,CDrawOleObj,图元的创建,永久支持: CDocument:Serialize-CObList:Serialize -CObject:Serialize CDrawObj:Clone DrawTool:创建图元对象,交互操作,键盘和菜单命令 MFC内部机制 鼠标操作 在CDrawView的鼠标处理函数中处理 工具箱

      3、:工具链,有一个当前活动工具 转交给当前活动工具来处理,工具箱和CDrawTool,class CDrawTool / Constructors public: CDrawTool(DrawShape nDrawShape); / Overridables virtual void OnLButtonDown(CDrawView* pView, UINT nFlags, const CPoint,DrawTool层次结构,CDrawTool CSelectTool CRectTool CPolyTool ,CDrawTool,CSelectTool,CRectTool,CPolyTool,例子中的模式,CDrawObj和CDrawTool合起来构成了Factory Method模式 CDrawTool:Clone用到了原型创建模式 每一个CDrawTool都是一个singleton Adapter模式:把OLE对象封装成CDrawObj * 可以增加Composite模式 facade模式:通过CDrawDoc/View与MFC通信 chain of responsibility:如鼠

      4、标处理工作 * 用Command模式增加undo/redo功能,patterns,定义: A physical arrangement of elements Repeating;with some degree of correspondence in successive trials or observations 典范、范例,事物的标准样式 In the book “Design Patterns”, the design patterns are descriptions of communicating objects and classes that are customized to solve a general design problem in a particular context Design patterns represent solutions to problems that arise when developing software within a particular context 几个近义词 idiom、technique、paradig

      5、m,About patterns,About patterns Documentation of expert software engineers “behavior“ Documentation of specific reoccurring problems (and solutions) Abstraction of common design occurrences Properties of design patterns A pattern addresses a recurring design problem that arises in specific design situations, and presents a solution to it. Patterns document existing, well-proven design experience. Patterns provide a common vocabulary and understanding for design principles. Patterns are a means o

      6、f documenting software architectures. Patterns support the construction of software with define properties. Patterns help you to manage software complexity.,pattern与framework,Patterns支持软件结构和设计的重用 抓住了特定领域中问题的成功解决方案中的静态、动态结构和相互之间的协作关系 patterns与开发语言无关,但是建立在一定的环境基础上 例如:经典的MVC、Factory Method frameworks支持细节设计和代码的重用 framework是一组组件的综合,这些组件相互协作,为一族相关应用提供了一个可重用的框架结构 例如:MMC、MS Script Engine 两者结合起来, design patterns and frameworks有助于提高软件的质量 比如:重用性,扩展性,性能,可维护性,Design pattern与framework(续),a framework supplies

      7、the infrastructure and mechanisms that execute a policy for interaction between abstract components with open implementations. frameworks are often said to abide by the Hollywood Principle (“Dont call us, well call you.“) 比较: Design patterns are more abstract than frameworks Design patterns are smaller architectural elements than frameworks Design patterns are less specialized than frameworks framework与class library(toolkit),Pattern的研究情况,关于pattern研究的历史 A Pattern Language,Christopher Alexander,19

      8、77 “Advanced C+:Programming Styles and Idioms”,James Coplien,1992 “Design Patterns: Elements of Reusable Object-Oriented Software”,GOF,1995 “Pattern-Oriented Software Architecture: A System of Patterns” (简称为“POSA”) ,GoV,1996 .,Pattern is a hot topic,在amazon上查找包含patterns的书(2002.12.12),Pattern的研究现状,pattern与Java pattern与CORBA pattern与系统结构 pattern与generic programming结合 其他(例如UML等),POSA中的模式分类,Architectural Patterns 表达了软件系统的基本结构组织形式或者结构方案 它包含一组预定义的子系统,规定了这些子系统的责任,同时还提供了用于组织和管理这些子系统的规则和向导 Design Pattern

      9、s 为软件系统的子系统、组件或者组件之间的关系提供一个精炼之后的解决方案 它描述了在特定环境下,用于解决通用软件设计问题的组件以及这些组件相互通信时的可重现结构 Idioms 是一个与编程语言相关的低级模式 它描述了如何实现组件的某些功能,或者利用编程语言的特性来实现组件内部要素之间的通信功能,POSA: Architectural Patterns(1),Architectural Patterns are very high-level structural patterns. Also called “Conceptual Patterns ” From Mud to Structure: Organize components. Layers: Organize components into layers where layer is services are only used by layer i+1. Pipes and Filters: Divide the task into several sequential processing steps - the output of task i is the input of task i+1. Blackboard: Several independent programs work cooperatively on a common data structure. Distributed Systems :Handle distributed computation. Broker: Introduce a broker component to to achieve better decoupling of clients and servers - brokers accept requests from clients and forward the requests to servers, then return the results back to the clients.,POSA: Architectural Patterns(2),In

      《软件设计模式(一)》由会员luoxia****01802分享,可在线阅读,更多相关《软件设计模式(一)》请在金锄头文库上搜索。

      点击阅读更多内容
    最新标签
    监控施工 信息化课堂中的合作学习结业作业七年级语文 发车时刻表 长途客运 入党志愿书填写模板精品 庆祝建党101周年多体裁诗歌朗诵素材汇编10篇唯一微庆祝 智能家居系统本科论文 心得感悟 雁楠中学 20230513224122 2022 公安主题党日 部编版四年级第三单元综合性学习课件 机关事务中心2022年全面依法治区工作总结及来年工作安排 入党积极分子自我推荐 世界水日ppt 关于构建更高水平的全民健身公共服务体系的意见 空气单元分析 哈里德课件 2022年乡村振兴驻村工作计划 空气教材分析 五年级下册科学教材分析 退役军人事务局季度工作总结 集装箱房合同 2021年财务报表 2022年继续教育公需课 2022年公需课 2022年日历每月一张 名词性从句在写作中的应用 局域网技术与局域网组建 施工网格 薪资体系 运维实施方案 硫酸安全技术 柔韧训练 既有居住建筑节能改造技术规程 建筑工地疫情防控 大型工程技术风险 磷酸二氢钾 2022年小学三年级语文下册教学总结例文 少儿美术-小花 2022年环保倡议书模板六篇 2022年监理辞职报告精选 2022年畅想未来记叙文精品 企业信息化建设与管理课程实验指导书范本 草房子读后感-第1篇 小数乘整数教学PPT课件人教版五年级数学上册 2022年教师个人工作计划范本-工作计划 国学小名士经典诵读电视大赛观后感诵读经典传承美德 医疗质量管理制度 2
    关于金锄头网 - 版权申诉 - 免责声明 - 诚邀英才 - 联系我们
    手机版 | 川公网安备 51140202000112号 | 经营许可证(蜀ICP备13022795号)
    ©2008-2016 by Sichuan Goldhoe Inc. All Rights Reserved.