0
00:00:00,350 --> 00:00:02,997
今天呢,我们来看一个用语
1
00:00:02,997 --> 00:00:04,100
非功能需求
2
00:00:04,620 --> 00:00:07,060
这个算不算糊涂用语
3
00:00:09,890 --> 00:00:13,000
这是来自一个学员的问题
4
00:00:13,000 --> 00:00:15,872
他说,之前你写的书里面
5
00:00:15,872 --> 00:00:19,940
把需求分为功能需求、非功能需求、设计约束
6
00:00:20,420 --> 00:00:23,370
第二版就把非功能需求改成
7
00:00:24,220 --> 00:00:25,740
质量需求了
8
00:00:26,820 --> 00:00:29,690
那非功能需求到底是不是
9
00:00:29,970 --> 00:00:31,820
糊涂用语
10
00:00:35,250 --> 00:00:36,980
那我们先说一下结论
11
00:00:37,940 --> 00:00:40,074
非功能需求属于
12
00:00:40,074 --> 00:00:41,260
属于模糊用语
13
00:00:42,900 --> 00:00:46,101
不过这个模糊是表达上的模糊
14
00:00:46,101 --> 00:00:48,160
它来源于历史习惯
15
00:00:48,540 --> 00:00:50,984
如果我们继续使用的话
16
00:00:50,984 --> 00:00:55,140
害处是比功能模块、用户需求之类的要小
17
00:00:59,930 --> 00:01:01,974
非功能需求
18
00:01:01,974 --> 00:01:04,530
这个用语模糊在哪里呢
19
00:01:05,570 --> 00:01:05,852
20
00:01:05,852 --> 00:01:06,980
模糊在
21
00:01:08,250 --> 00:01:09,480
你看,我们
22
00:01:10,200 --> 00:01:14,645
这样写,需求分为功能需求、非功能需求、设计约束
23
00:01:14,645 --> 00:01:15,280
这是我们
24
00:01:15,560 --> 00:01:17,260
刚才那个表述嘛
25
00:01:19,570 --> 00:01:23,640
那我们看,假设把需求看作全集
26
00:01:24,520 --> 00:01:26,670
功能需求是它的一个子集
27
00:01:27,180 --> 00:01:29,875
另外一个子集叫非功能需求
28
00:01:29,875 --> 00:01:31,120
那你看从这个
29
00:01:31,820 --> 00:01:33,703
含义上,非功能需求
30
00:01:33,703 --> 00:01:35,796
意思是功能需求的非
31
00:01:35,796 --> 00:01:37,262
就是它的补集嘛
32
00:01:37,262 --> 00:01:37,890
对不对
33
00:01:39,190 --> 00:01:40,720
全集里面
34
00:01:41,130 --> 00:01:43,330
除了功能需求之外
35
00:01:44,300 --> 00:01:46,900
那个集合,补集
36
00:01:49,000 --> 00:01:50,401
那既然是补集
37
00:01:50,401 --> 00:01:54,373
那应该是,功能需求和功能需求的补集
38
00:01:54,373 --> 00:01:57,410
并在一起就得到了需求
39
00:01:57,410 --> 00:01:59,512
那就没有设计约束了
40
00:01:59,512 --> 00:02:00,213
对不对
41
00:02:00,213 --> 00:02:00,447
42
00:02:00,447 --> 00:02:06,054
这两个加在一起就已经得到了整体的嘛,这功能需求
43
00:02:06,054 --> 00:02:09,324
剩下的非功能需求,没有了
44
00:02:09,324 --> 00:02:10,960
设计约束没有了
45
00:02:12,180 --> 00:02:12,402
46
00:02:12,402 --> 00:02:13,740
模糊在这里
47
00:02:15,300 --> 00:02:16,780
但是这个模糊
48
00:02:17,660 --> 00:02:17,923
49
00:02:17,923 --> 00:02:20,030
并不是我创造的
50
00:02:20,400 --> 00:02:23,680
那么也肯定是很久以前
51
00:02:24,450 --> 00:02:26,325
我从书里面学来的
52
00:02:26,325 --> 00:02:28,903
因为过去的教材等等
53
00:02:28,903 --> 00:02:30,309
都这么讲的
54
00:02:30,309 --> 00:02:31,716
你看,我摘几本
55
00:02:31,716 --> 00:02:34,060
我手上有的中文的
56
00:02:34,410 --> 00:02:36,235
中文或中译本的书
57
00:02:36,235 --> 00:02:37,250
我们看一眼
58
00:02:37,600 --> 00:02:41,334
那这里只是展示说书里面有这个内容
59
00:02:41,334 --> 00:02:43,693
不评价这个书的质量好坏
60
00:02:43,693 --> 00:02:47,231
不要误解我推荐或者不推荐这本书
61
00:02:47,231 --> 00:02:50,180
没有任何推荐或不推荐的意思
62
00:02:52,060 --> 00:02:52,253
63
00:02:52,253 --> 00:02:55,542
比如说,2019年这个《软件工程》
64
00:02:55,542 --> 00:02:56,510
这是翻译的
65
00:02:57,340 --> 00:02:58,060
你看
66
00:02:59,640 --> 00:03:02,529
这里面写,有功能需求
67
00:03:02,529 --> 00:03:02,770
有
68
00:03:03,340 --> 00:03:04,542
非功能需求
69
00:03:04,542 --> 00:03:06,144
设计约束,几个并列
70
00:03:06,144 --> 00:03:06,545
对吧
71
00:03:06,545 --> 00:03:09,350
它这里把质量需求跟非功能需求
72
00:03:09,870 --> 00:03:11,976
这两个是对等的
73
00:03:11,976 --> 00:03:14,346
这两个是一个意思
74
00:03:14,346 --> 00:03:14,610
75
00:03:15,510 --> 00:03:17,857
你看,它也是这样表达的
76
00:03:17,857 --> 00:03:18,640
功能需求
77
00:03:18,920 --> 00:03:20,660
非功能需求、设计约束
78
00:03:21,180 --> 00:03:22,550
79
00:03:24,500 --> 00:03:25,780
80
00:03:26,060 --> 00:03:27,204
机械工业出版社
81
00:03:27,204 --> 00:03:28,021
2018年
82
00:03:28,021 --> 00:03:30,310
这个也是翻译的,软件工程导论
83
00:03:30,630 --> 00:03:32,400
并列的,功能需求
84
00:03:33,610 --> 00:03:33,813
85
00:03:33,813 --> 00:03:35,034
非功能需求
86
00:03:35,034 --> 00:03:37,678
设计约束,上一页是功能需求
87
00:03:37,678 --> 00:03:40,120
非功能需求,跟设计约束
88
00:03:40,400 --> 00:03:41,190
89
00:03:42,400 --> 00:03:43,660
并列的
90
00:03:45,750 --> 00:03:45,958
91
00:03:45,958 --> 00:03:47,830
这个是Ivar Jacobson
92
00:03:47,830 --> 00:03:48,870
就是UML的
93
00:03:49,610 --> 00:03:51,356
创造者之一
94
00:03:51,356 --> 00:03:53,540
他自己写的这个书
95
00:03:53,820 --> 00:03:54,010
96
00:03:54,010 --> 00:03:55,340
你看,他这里面是
97
00:03:55,850 --> 00:03:59,950
把这三个,功能需求、非功能需求、设计约束
98
00:04:00,230 --> 00:04:01,110
并列
99
00:04:03,150 --> 00:04:05,665
这是国外的翻译过来的
100
00:04:05,665 --> 00:04:07,265
那国内的也一样
101
00:04:07,265 --> 00:04:08,180
你看,这是
102
00:04:08,460 --> 00:04:12,730
国内的,徐锋写的软件需求最佳实践
103
00:04:13,010 --> 00:04:14,060
这里也是写
104
00:04:14,350 --> 00:04:16,544
分为三种类型,功能需求
105
00:04:16,544 --> 00:04:18,340
非功能需求、设计约束
106
00:04:19,930 --> 00:04:20,280
107
00:04:20,280 --> 00:04:20,980
这个
108
00:04:21,260 --> 00:04:22,540
是
109
00:04:23,090 --> 00:04:26,154
很多时候我们习惯是这样用
110
00:04:26,154 --> 00:04:28,040
但确实是模糊用语
111
00:04:30,100 --> 00:04:31,455
那怎么修正呢
112
00:04:31,455 --> 00:04:33,489
怎么表达更严谨一点
113
00:04:33,489 --> 00:04:36,652
有这么几个方案,我们来评价一下
114
00:04:36,652 --> 00:04:37,330
第一个
115
00:04:38,250 --> 00:04:41,255
我们认为这个设计约束不是需求
116
00:04:41,255 --> 00:04:43,660
你可以说设计约束不是需求
117
00:04:44,260 --> 00:04:44,547
118
00:04:44,547 --> 00:04:47,420
但是呢,这个肯定不好了
119
00:04:48,250 --> 00:04:49,200
因为
120
00:04:50,090 --> 00:04:51,962
这三个并列在一起
121
00:04:51,962 --> 00:04:54,069
你不管叫它阿猫阿狗
122
00:04:54,069 --> 00:04:55,240
叫ABCD
123
00:04:55,970 --> 00:04:58,600
它就是需求的一种
124
00:04:59,170 --> 00:05:00,740
它肯定是符合什么
125
00:05:01,680 --> 00:05:03,460
不这样不行
126
00:05:05,120 --> 00:05:06,204
什么叫需求
127
00:05:06,204 --> 00:05:07,940
就是如果不这样
128
00:05:08,420 --> 00:05:10,670
就会损害设计的利益
129
00:05:10,980 --> 00:05:13,385
那设计约束确实是需求的一种
130
00:05:13,385 --> 00:05:13,940
比如说
131
00:05:15,260 --> 00:05:17,170
我们这个界面
132
00:05:17,800 --> 00:05:18,640
133
00:05:19,310 --> 00:05:22,770
左上角一定要
134
00:05:23,120 --> 00:05:24,899
有一个章
135
00:05:24,899 --> 00:05:27,272
这个章的颜色一定是这样的
136
00:05:27,272 --> 00:05:27,668
形状
137
00:05:27,668 --> 00:05:28,656
必须这样的
138
00:05:28,656 --> 00:05:29,250
为什么
139
00:05:29,530 --> 00:05:31,148
因为是政府的规定
140
00:05:31,148 --> 00:05:32,968
那个章已经规定好了
141
00:05:32,968 --> 00:05:35,800
这个式样,你不要自己乱发挥
142
00:05:36,160 --> 00:05:36,345
143
00:05:36,345 --> 00:05:38,012
不能说,这个不漂亮
144
00:05:38,012 --> 00:05:39,309
我给你搞一个
145
00:05:39,309 --> 00:05:40,050
我找那个
146
00:05:40,410 --> 00:05:43,485
设计师去搞更漂亮的界面
147
00:05:43,485 --> 00:05:44,100
不行的
148
00:05:44,770 --> 00:05:48,930
人家规定格式就是这样的一个格式
149
00:05:49,610 --> 00:05:50,550
所以呢
150
00:05:51,340 --> 00:05:53,476
这个确实是属于什么
151
00:05:53,476 --> 00:05:54,900
不这样不行
152
00:05:57,290 --> 00:05:59,020
或者说我们
153
00:05:59,300 --> 00:06:00,310
数据库
154
00:06:00,940 --> 00:06:02,200
一定要用Oracle
155
00:06:04,200 --> 00:06:05,203
为什么呢
156
00:06:05,203 --> 00:06:05,453
157
00:06:05,453 --> 00:06:07,460
因为我们的客户
158
00:06:09,560 --> 00:06:11,900
他以前买了很多Oracle的产品
159
00:06:12,830 --> 00:06:14,350
所以呢他数据
160
00:06:15,290 --> 00:06:16,820
放在Oracle上面
161
00:06:17,140 --> 00:06:18,250
来保存
162
00:06:18,810 --> 00:06:21,140
对他来说是比较划算的
163
00:06:21,460 --> 00:06:24,830
不用重复再买购买类似的产品
164
00:06:26,130 --> 00:06:26,576
它是
165
00:06:26,576 --> 00:06:28,140
来自涉众的要求
166
00:06:28,420 --> 00:06:29,328
不这样不行
167
00:06:29,328 --> 00:06:31,145
否则就会损害涉众的利益
168
00:06:31,145 --> 00:06:31,690
对不对
169
00:06:32,100 --> 00:06:32,632
不是来自
170
00:06:32,632 --> 00:06:33,696
开发团队
171
00:06:33,696 --> 00:06:36,179
不是说,因为我们对Oracle比较熟
172
00:06:36,179 --> 00:06:38,840
所以那个,不是这个,来自涉众的
173
00:06:39,370 --> 00:06:42,280
跟我们开发不开发这个没有关系的
174
00:06:44,070 --> 00:06:46,470
跟我们开发团队的特点没有关系
175
00:06:48,700 --> 00:06:50,760
所以呢,这个是不合适
176
00:06:52,250 --> 00:06:53,580
第二种就是
177
00:06:55,260 --> 00:06:57,210
我们可以认为
178
00:06:57,740 --> 00:06:58,920
设计约束
179
00:06:59,500 --> 00:07:02,690
是非功能需求的一种
180
00:07:04,470 --> 00:07:04,706
181
00:07:04,706 --> 00:07:05,650
这个可以
182
00:07:06,600 --> 00:07:07,170
183
00:07:08,280 --> 00:07:09,740
这样就是可以的
184
00:07:10,340 --> 00:07:13,460
需求等于功能需求+非功能需求
185
00:07:14,060 --> 00:07:17,190
而设计约束是非功能需求的一种
186
00:07:18,290 --> 00:07:19,865
把它放到下层了
187
00:07:19,865 --> 00:07:22,115
不再跟之前那个并列
188
00:07:22,115 --> 00:07:22,790
对不对
189
00:07:25,300 --> 00:07:26,940
但这个有什么不好
190
00:07:27,270 --> 00:07:27,446
191
00:07:27,446 --> 00:07:30,265
就是它变成一种什么,这个非功能需求
192
00:07:30,265 --> 00:07:32,380
就变成一个口袋的一个名字
193
00:07:35,070 --> 00:07:36,046
功能需求
194
00:07:36,046 --> 00:07:37,610
剩下的,非功能需求
195
00:07:38,420 --> 00:07:40,060
口袋的
196
00:07:40,500 --> 00:07:42,750
人有男人
197
00:07:43,360 --> 00:07:45,092
还有不是男人的人
198
00:07:45,092 --> 00:07:45,308
199
00:07:45,308 --> 00:07:46,391
这个可以
200
00:07:46,391 --> 00:07:48,340
但这个肯定是不好的
201
00:07:48,340 --> 00:07:50,721
因为他放一个口袋在那里
202
00:07:50,721 --> 00:07:53,320
把这种乱七八糟的装进去了
203
00:07:53,830 --> 00:07:54,912
那说明什么
204
00:07:54,912 --> 00:07:56,860
我们没有把它分清楚
205
00:07:56,860 --> 00:07:59,458
就像我们物理学一样的
206
00:07:59,458 --> 00:08:01,840
物理有几种力
207
00:08:02,330 --> 00:08:02,622
208
00:08:02,622 --> 00:08:03,500
有这个力
209
00:08:04,230 --> 00:08:06,940
然后你拿一个口袋
210
00:08:07,740 --> 00:08:08,765
非什么什么力
211
00:08:08,765 --> 00:08:10,815
剩下的都叫非什么什么力
212
00:08:10,815 --> 00:08:11,840
那不好
213
00:08:13,870 --> 00:08:18,290
第三种就是说把这口袋命名去掉
214
00:08:19,040 --> 00:08:22,000
改为这种比较明确的命名
215
00:08:22,850 --> 00:08:23,111
216
00:08:23,111 --> 00:08:24,680
就像刚才讲的
217
00:08:24,990 --> 00:08:31,060
比如说,需求等于功能需求、质量需求、设计约束
218
00:08:32,390 --> 00:08:33,640
这样可以
219
00:08:34,010 --> 00:08:35,778
但这个也是冗余
220
00:08:35,778 --> 00:08:36,220
你看
221
00:08:36,630 --> 00:08:37,543
写什么需求
222
00:08:37,543 --> 00:08:39,004
需求,没有必要嘛
223
00:08:39,004 --> 00:08:39,370
对吧
224
00:08:40,350 --> 00:08:43,294
能不写就不写
225
00:08:43,294 --> 00:08:48,300
我的意见就是直接功能、性能、设计约束
226
00:08:48,920 --> 00:08:50,030
就行了
227
00:08:52,980 --> 00:08:55,350
能少写几个字就少写几个字
228
00:08:57,420 --> 00:09:01,300
那这里的性能就包含了我们以前的
229
00:09:02,630 --> 00:09:05,347
所谓非功能需求里面的内容
230
00:09:05,347 --> 00:09:07,020
包括速度、容量
231
00:09:07,400 --> 00:09:10,654
可靠性、可用性等等
232
00:09:10,654 --> 00:09:12,429
在这里面
233
00:09:12,429 --> 00:09:14,500
我们都统一叫性能
234
00:09:16,570 --> 00:09:18,590
那我推荐是这样用
235
00:09:20,670 --> 00:09:23,602
设计约束这个设计要不要删掉
236
00:09:23,602 --> 00:09:23,811
237
00:09:23,811 --> 00:09:24,230
238
00:09:24,230 --> 00:09:25,697
这个好像不好删
239
00:09:25,697 --> 00:09:28,420
因为这个是设计时候的约束
240
00:09:28,700 --> 00:09:30,520
不是别的约束
241
00:09:30,520 --> 00:09:32,860
是在实现过程中
242
00:09:33,340 --> 00:09:34,494
出于涉众利益
243
00:09:34,494 --> 00:09:35,880
不得不遵守的
244
00:09:38,530 --> 00:09:41,294
比如说,就像刚才讲的
245
00:09:41,294 --> 00:09:42,907
数据库一定Oracle
246
00:09:42,907 --> 00:09:44,520
为什么,人家单位
247
00:09:45,680 --> 00:09:47,170
他就这样要求的
248
00:09:48,240 --> 00:09:50,050
因为这样要求对他有利
249
00:09:52,870 --> 00:09:55,000
如果你光写约束的话
250
00:09:55,000 --> 00:09:58,788
很容易跟业务规则搞混在一起
251
00:09:58,788 --> 00:09:59,025
252
00:09:59,025 --> 00:10:02,576
而业务规则属于什么
253
00:10:02,576 --> 00:10:04,470
属于功能的部分
254
00:10:05,670 --> 00:10:07,584
它是核心域的概念
255
00:10:07,584 --> 00:10:09,260
比如说,计费的规则
256
00:10:09,670 --> 00:10:11,990
它是附属在计费里面的
257
00:10:13,650 --> 00:10:16,168
计费有个计费的规则
258
00:10:16,168 --> 00:10:18,457
是一个公式
259
00:10:18,457 --> 00:10:22,120
这个费加这个费加这个费乘以多少
260
00:10:23,550 --> 00:10:26,992
不能光写约束,要设计约束
261
00:10:26,992 --> 00:10:30,680
在设计过程中不得不遵守的约束