0
00:00:00,960 --> 00:00:03,020
今天我们继续说一下
1
00:00:03,460 --> 00:00:05,350
实现领域驱动设计
2
00:00:05,630 --> 00:00:08,120
译文里面暴露的问题
3
00:00:10,630 --> 00:00:14,740
前面三个视频,我们提到了第①句
4
00:00:15,550 --> 00:00:16,900
存在的问题
5
00:00:17,220 --> 00:00:21,360
以及背后可能的思想根源
6
00:00:21,720 --> 00:00:22,770
那我们
7
00:00:23,330 --> 00:00:25,420
今天开始来看第②句
8
00:00:31,200 --> 00:00:31,456
9
00:00:31,456 --> 00:00:33,250
第②句原文这个
10
00:00:34,080 --> 00:00:34,354
11
00:00:34,354 --> 00:00:36,820
中译本译文这个
12
00:00:38,760 --> 00:00:41,260
首先,第一个问题
13
00:00:45,780 --> 00:00:47,940
并不存在遍历
14
00:00:50,970 --> 00:00:51,770
你看
15
00:00:54,090 --> 00:00:55,820
原文是这样
16
00:00:57,090 --> 00:00:58,173
译文是这样
17
00:00:58,173 --> 00:00:59,690
那我们来看一下
18
00:01:02,950 --> 00:01:03,459
原文
19
00:01:03,459 --> 00:01:06,770
它用词只用了navigate
20
00:01:07,050 --> 00:01:07,410
21
00:01:07,410 --> 00:01:09,210
意思是导航
22
00:01:11,330 --> 00:01:12,992
它并没有用遍历
23
00:01:12,992 --> 00:01:14,655
如果它用遍历的话
24
00:01:14,655 --> 00:01:16,110
它应该用的什么
25
00:01:16,390 --> 00:01:19,370
traversal或者traverse
26
00:01:19,950 --> 00:01:21,710
类似这样的词
27
00:01:22,220 --> 00:01:23,730
意思是遍历
28
00:01:25,020 --> 00:01:29,447
遍历在计算机科学的特定场景里面
29
00:01:29,447 --> 00:01:31,010
它的意思就是
30
00:01:31,290 --> 00:01:33,780
访问所有的结点
31
00:01:37,140 --> 00:01:38,180
但是
32
00:01:39,210 --> 00:01:40,500
我们要知道
33
00:01:41,710 --> 00:01:44,400
在一个整体-部分结构的
34
00:01:45,010 --> 00:01:46,080
这样一个
35
00:01:46,410 --> 00:01:47,420
里面
36
00:01:47,970 --> 00:01:51,030
整体对象要履行责任的时候
37
00:01:51,570 --> 00:01:54,830
它并不需要遍历所有的部件
38
00:01:56,760 --> 00:01:57,970
也就是说
39
00:01:59,370 --> 00:02:00,830
一个对象
40
00:02:01,110 --> 00:02:03,320
在执行某个行为的时候
41
00:02:04,470 --> 00:02:06,330
并不一定涉及(当然,也可以涉及)
42
00:02:07,710 --> 00:02:10,650
所有直接或间接的
43
00:02:11,620 --> 00:02:13,040
部分对象
44
00:02:17,220 --> 00:02:19,380
比如说,这是类图
45
00:02:19,890 --> 00:02:21,790
A组合B
46
00:02:22,070 --> 00:02:25,200
B组合DE,A组合C
47
00:02:26,310 --> 00:02:28,780
对象图我们画出来是这样
48
00:02:29,060 --> 00:02:31,200
A对象,a1
49
00:02:31,480 --> 00:02:31,749
50
00:02:31,749 --> 00:02:34,173
组合了一个b1、b2
51
00:02:34,173 --> 00:02:35,790
这两个都是B
52
00:02:36,070 --> 00:02:39,800
还组合两个C,也就是,a里面有两个b两个c
53
00:02:40,150 --> 00:02:44,061
b里面它自己也有自己内部结构了
54
00:02:44,061 --> 00:02:44,550
55
00:02:45,520 --> 00:02:47,030
那当a
56
00:02:48,520 --> 00:02:50,200
执行某个操作
57
00:02:51,120 --> 00:02:53,160
或者说,它收到某个消息
58
00:02:55,010 --> 00:02:57,080
要执行某个操作的时候
59
00:02:57,380 --> 00:02:59,933
可能只会影响到
60
00:02:59,933 --> 00:03:00,630
只会把
61
00:03:00,930 --> 00:03:04,620
这个操作分解分配发给它的
62
00:03:05,910 --> 00:03:07,816
下面的某个部件
63
00:03:07,816 --> 00:03:09,450
比如说,发给b1
64
00:03:11,180 --> 00:03:11,364
65
00:03:11,364 --> 00:03:13,210
b2可能就不会发给它
66
00:03:14,990 --> 00:03:16,706
同时可能发给c1
67
00:03:16,706 --> 00:03:18,208
c2可能不会发
68
00:03:18,208 --> 00:03:19,710
也可能只发给b
69
00:03:19,990 --> 00:03:21,383
c都不会发
70
00:03:21,383 --> 00:03:22,080
对不对
71
00:03:23,230 --> 00:03:27,730
就像我们订单里面有很多属性嘛
72
00:03:27,730 --> 00:03:29,700
有若干个订单项
73
00:03:29,700 --> 00:03:31,950
还有下单日期
74
00:03:31,950 --> 00:03:36,170
还有其他的一些
75
00:03:36,450 --> 00:03:38,460
包括配送地址什么之类的
76
00:03:39,120 --> 00:03:41,691
那很可能它现在收到一个消息说
77
00:03:41,691 --> 00:03:42,680
我要修改
78
00:03:43,500 --> 00:03:43,774
79
00:03:43,774 --> 00:03:44,870
某个地址
80
00:03:46,050 --> 00:03:49,050
那可能影响的是地址这个属性而已
81
00:03:50,110 --> 00:03:53,131
其他的不影响,下单日期,不影响
82
00:03:53,131 --> 00:03:53,664
对不对
83
00:03:53,664 --> 00:03:55,619
或者说,我删除某个订单项
84
00:03:55,619 --> 00:03:57,930
我从订单里面删除某个订单项
85
00:03:57,930 --> 00:03:59,885
那只是影响到那个订单项
86
00:03:59,885 --> 00:04:01,840
其他订单项不受影响
87
00:04:02,130 --> 00:04:03,658
怎么可能要遍历呢
88
00:04:03,658 --> 00:04:05,187
不可能遍历的嘛
89
00:04:05,187 --> 00:04:05,570
对吧
90
00:04:08,590 --> 00:04:10,730
或者我们举最简单的例子
91
00:04:11,010 --> 00:04:13,085
类和属性,就知道了嘛
92
00:04:13,085 --> 00:04:15,160
一个类有很多个属性
93
00:04:15,620 --> 00:04:17,070
很多个操作
94
00:04:17,070 --> 00:04:18,520
那某个操作
95
00:04:19,340 --> 00:04:22,160
可能涉及到的只是其中
96
00:04:24,220 --> 00:04:25,695
某些属性
97
00:04:25,695 --> 00:04:29,067
这个操作可能涉及到的,可能是这里面
98
00:04:29,067 --> 00:04:29,910
某些属性
99
00:04:30,190 --> 00:04:30,393
100
00:04:30,393 --> 00:04:32,017
也可能是重叠的
101
00:04:32,017 --> 00:04:32,830
它不会说
102
00:04:33,250 --> 00:04:34,618
执行一个操作
103
00:04:34,618 --> 00:04:36,670
所有的属性都要访问
104
00:04:36,950 --> 00:04:38,450
或者说都要修改
105
00:04:39,150 --> 00:04:40,300
那不会的了
106
00:04:40,300 --> 00:04:40,990
对不对
107
00:04:42,110 --> 00:04:42,367
108
00:04:42,367 --> 00:04:44,940
所以呢,这个不是英文的
109
00:04:45,220 --> 00:04:48,530
翻译的问题,是我们在概念上
110
00:04:48,810 --> 00:04:50,260
就没有搞清楚
111
00:04:51,030 --> 00:04:51,216
112
00:04:51,216 --> 00:04:53,081
不存在遍历的问题
113
00:04:53,081 --> 00:04:55,880
跟我们前面讲那个关联是一样的
114
00:04:56,400 --> 00:04:58,426
不是说,我英语不好
115
00:04:58,426 --> 00:04:59,552
用词用错了
116
00:04:59,552 --> 00:05:01,128
不是这个意思
117
00:05:01,128 --> 00:05:03,154
当然也有这方面因素
118
00:05:03,154 --> 00:05:03,830
但是呢
119
00:05:04,460 --> 00:05:06,280
关键点不在这里
120
00:05:07,230 --> 00:05:08,340
这是第(1)点
121
00:05:10,330 --> 00:05:11,330
第(2)点
122
00:05:11,950 --> 00:05:13,862
那我们再往外推
123
00:05:13,862 --> 00:05:15,350
你看,它说什么
124
00:05:20,310 --> 00:05:23,240
深度地递归遍历
125
00:05:23,530 --> 00:05:25,930
首先深度地,这是有的
126
00:05:26,220 --> 00:05:28,310
遍历是没有的,是导航
127
00:05:28,590 --> 00:05:29,220
对吧
128
00:05:29,500 --> 00:05:33,520
但这个递归是译者自己加上去的
129
00:05:35,570 --> 00:05:39,490
那为什么有这样的一个翻译
130
00:05:39,770 --> 00:05:42,350
背后可能会有什么样的
131
00:05:44,000 --> 00:05:45,278
思想的根源
132
00:05:45,278 --> 00:05:47,580
这个我们下次再说