File tree 3 files changed +61
-0
lines changed
3 files changed +61
-0
lines changed Original file line number Diff line number Diff line change
1
+ # 实验四五:类建模、高级类建模
2
+
3
+ ## 一、实验目标
4
+
5
+ 1.掌握类建模方法
6
+ 2.了解MVC或个人所熟悉的设计模式
7
+ 3.掌握类图(Class Diagram)的画法
8
+ 4.理解类的5种关系
9
+ 5.掌握类之间关系的画法
10
+
11
+ ## 二、实验内容
12
+
13
+ 1.学习类的概念以及类建模方法
14
+ 2.学习类的5种关系
15
+ 3.学习MVC设计模式
16
+ 4.绘制类图
17
+
18
+ ## 三、学习笔记
19
+
20
+ 1.What is a class?
21
+ - It has an identity.
22
+ - A class is a type of something.
23
+ - Attributes and operations are the mainstays of a class's description.(属性与操作)
24
+
25
+ 2.At its simplest,a class in UML is drawn as a rectangle split into up to three sections.(用尖角矩形表示)
26
+ - The top section contains the name of the class.(名称)
27
+ - The middle section contains the attributes or information that the class contains.(属性)
28
+ - The final section contains the operations that represent the behavior that the class exhibits.(操作)
29
+
30
+ 3.UML's four different visibility classifications.
31
+ - Public、Protected、Package、Private.
32
+
33
+ 4.Class relationships.(It's better to build a weak class relationship——低耦合)
34
+ - Dependency: When objects of one class work briefly with objects of another class.(Weaker class relationship)
35
+ - Association.(联合)
36
+ - Aggregation.(聚合)
37
+ - Composition.(组合)
38
+ - Inheritance: When one class is a type of another class.(stronger class relationship)
39
+
40
+ 5.MVC Design Pattern
41
+ - Model.(模型、实体、数据)
42
+ - View.(视图、界面)
43
+ - Control.(控制器、系统)
44
+
45
+ ## 四、实验步骤
46
+ 1.在类图中增加Control类(发放优惠券控制器和领取优惠券控制器)
47
+ 2.在类图中增加View类(优惠券的信息填写页面和已发放优惠券的信息页面)
48
+ 3.根据用例规约提取出各类信息、数据
49
+ 4.将提取出的信息、数据抽象成类,作为MVC设计模式中的Model
50
+ 5.在类图中增加Model类
51
+ 6.设计各Model类之间的关系
52
+
53
+ ## 五、实验结果
54
+ ![ 活动图] ( ./Send_MVC_ClassDiagram.jpg )
55
+ 图1:发放优惠券的类图
56
+
57
+ ![ 活动图] ( ./Receive_MVC_ClassDiagram.jpg )
58
+ 图2:领取优惠券的类图
59
+
60
+ ## 六、实验总结
61
+ 通过这一次实验,我学习了类的基本概念、类建模方法、类之间的关系以及MVC设计模式。在画类图的过程中,我认为最重要的是要把用例规约中的各类信息、数据找出来,并抽象成一个类,最后还要考虑这些类之间是否存在着某种关系。从MVC设计模式角度来看,主要就是要找出Model以及Model之间的关系。如果能把这些理清楚,那么类图就基本没什么问题了。
You can’t perform that action at this time.
0 commit comments