需要安装的工具
1、astahpro710
2、StarUML-v2.6.0 工具
3、Visio+Viewer31
UML画图
1.1、打开 StarUML-v2.6.0 工具
1.2、创建一个类

1.3、添加属性

1.4、添加方法

1.5、双击增加方法

1.6、添加参数

1.7、返回值类型

2.1、创建 Interface 接口

改变 画框的类型:comand shfit + 0\1\2\3\45
实现协议方法



// 关联关系: 一对多、多对一、多对多
3.1、单项关联
1 --> 4 一对多
* --> 1 多对一
3.2、双向关联
4.1、聚合关系是一个特殊的,依赖较强的关联的关系
Swift ——-> t
电视机——> 显示器 (聚合)
4.2、组合关系:复合聚合关系
组合关系:组合进来的类,生命周期是一样的

5.1、依赖关系:一个对象里面用到了其它对象

#import "Person.h"
@implementation Person
- (int)personAndGun:(Gun *)gun {
return [gun countOfZidan];
}
@end
#import "Gun.h"
@implementation Gun
- (int)countOfZidan {
return 10;
}
@end
#import <Foundation/Foundation.h>
#import "Person.h"
#import "Gun.h"
int main(int argc, const char * argv[]) {
@autoreleasepool {
Gun *gun = [Gun new];
Person *per = [Person new];
// 依赖关系,一个对象里面用到了其它对象 gun的变化会引起per的变化
int count = [per personAndGun:gun];
NSLog(@"---%d--",count);
}
return 0;
}
6、实现关系:类和接口

神州一号飞船是神州系列的一种
(继承)
,它由轨道仓,返回舱,推进舱和逃逸救生舱等组成(聚合关系)
,航天员可以在返回舱内驾驶飞船(依赖关系)
,轨道仓是航天员工作休息的场所(依赖关系)
. 在紧急情况下,可以利用逃逸救生舱逃生(依赖)
. 在飞船两侧有多个太阳能电池翼,可以为飞船提供电能.(聚合关系)
comand + L: 调正
comand + B: 回调,拉折


7.1、创建用例模型




7.2、对象图

7.3、组件图


7.4、部署图


8、静态模型

9、动态模型(可以导出处代码)
红色段:是一大段代码
实线单箭头:异步消息
实线双箭头:同步消息
虚线:消息返回

网友评论