- 1、本文档共36页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 5、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 6、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 7、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 8、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
2012/11/19 Monday
设计模式分类标准
1 设计模式有两种分类标准,按用途来分:
2 按scope来分,主要分成类模式和对象模式两类。
a) 类模式处理类和其子类之间的关系,这种关系一般是通过继承实现的,因此在编译时就已经确定。
b) 对象模式处理对象间的关系,这种关系可在运行时修改,更灵活。
c) 因为大部分的模式都用到了继承,因此只有少数几个模式被认为是类模式。Class patterns deal with relationships between classes and their subclasses. These relationships are established through inheritance, so they are static—fixed at compile-time. Object patterns deal with object relationships, which can be changed at run-time and are more dynamic. Almost all patterns use inheritance to some extent. So the only patterns labeled class patterns are those that focus on class relationships. Note that most patterns are in the Object scope.
3 An object packages both data and the procedures that operate on that data. The procedures are typically called methods or operations. An object performs an operation when it receives a request (or message) from a client.
4 Requests are the only way to get an object to execute an operation. Operations are the only way to change an objects internal data. Because of these restrictions, the objects internal state is said to be encapsulated; it cannot be accessed directly, and its representation is invisible from outside the object.
5 面向对象设计的难点: decomposing a system into objects,可考虑的因素太多,又没有唯一合适的标准。
6 Many objects in a design come from the analysis model. But object-oriented designs often end up with classes that have no counterparts in the real world. Some of these are low-level classes like arrays. Others are much higher-level. For example, the Composite (183) pattern introduces an abstraction for treating objects uniformly that doesnt have a physical counterpart. Strict modeling of the real world leads to a system that reflects todays realities but not necessarily tomorrows. The abstractions that emerge during design are key to making a design flexible.
7 Every operation declared by an object specifies the
您可能关注的文档
最近下载
- 国开02047_政府经济学-机考复习资料.docx VIP
- 特殊教育:培智部五年级生活数学B卷.docx
- OBE理念指导下的软件实训课教学改革实践探索.docx VIP
- 安检现场处置单位广州民航王超58课件.pptx VIP
- (2025春新版本)七年级下册道德与法治知识点总结.pdf VIP
- 微软-2025-该年前沿企业诞生(英译中).pdf
- 2024年华为认证HCIE存储H13-629必备考试题库大全(含答案).docx VIP
- 房地产管理新加坡房地产经济.docx VIP
- T_CERDS 3-2022 企业ESG评价体系.docx VIP
- 2024年公安机关人员基础知识考试题库及答案 (新版).docx
文档评论(0)