前面这几部分内容都是作为后面的设计模式的背景知识,介于程序猿都有所了解,整理的比价粗糙,网上有好多这方面资料。
2、UML
UML是一种用于创建程序模型的图形语言,提供多种不同的图以用于分析、设计和部署(deployment)。
当你在… | 所用UML图 |
分析阶段 | 用例图,所涉及的是与系统之间交互的实体,以及需要实现的功能点。 活动图,关注的是问题领域,而不是程序的逻辑流。 |
观察对象的交互 | 交互图,说明了特定对象如何交互,因为它们处理的都是具体情况而不是一般情况,在检查需求和设计是都很有用,最常见的一种交互图是顺序图。 |
设计阶段 | 类图,详细描述了类之间的关系。 |
观察对象所处状态不同时行为的差异 | 状态图,详细描述了对象可能所处的不同状态以及在这些状态之间的转换。 |
配置阶段 | 部署图,说明了如何部署不同的模块。 |
对这部分内容,大概做了如下笔记
需要强调的是composition和aggregation两种关系,另外UML书中的组合和聚集的概念与《设计模式》书中的完全相反,坑爹了有木有!!
Composition 组合
这种has-a关系,后者是它的一部分,Car有Tire和其他东西组成,另外图上Car使用了(use-a)加油站GassStation。
Aggregation 聚集
这种has-a关系,Airport拥有Aircraft,Aircraft并不是Airport的一部分。
Aircraft是一个抽象类,斜体。
其他参考
这个资料比价全,对UML不清楚可以大概参考一下。 http://kb.cnblogs.com/page/129068/#4
因为重点不在于讨论UML所以,对于UML方面的知识讨论仅限于足够讨论设计模式,上面写的内容只能够使你具备阅读后面笔记的模型图所需的最低限度的知识。