0
00:00:00,430 --> 00:00:03,470
今天呢,我们来说一个主题
1
00:00:03,810 --> 00:00:04,041
2
00:00:04,041 --> 00:00:05,430
我们来谈一谈
3
00:00:05,960 --> 00:00:07,710
实现领域驱动设计
4
00:00:09,120 --> 00:00:11,070
这本书的中译本
5
00:00:11,460 --> 00:00:14,090
的译文背后暴露的问题
6
00:00:15,760 --> 00:00:18,570
可能要分很多个视频来谈
7
00:00:22,160 --> 00:00:25,690
首先,要先说在前面的
8
00:00:26,790 --> 00:00:27,122
9
00:00:27,122 --> 00:00:28,120
就是说
10
00:00:28,400 --> 00:00:31,500
为什么我要批评这个书的翻译
11
00:00:32,570 --> 00:00:33,700
起源
12
00:00:34,190 --> 00:00:35,904
在2019年的时候
13
00:00:35,904 --> 00:00:38,380
我已经写文章批评过这个书了
14
00:00:39,260 --> 00:00:39,488
15
00:00:39,488 --> 00:00:40,632
当时是什么
16
00:00:40,632 --> 00:00:41,090
就是
17
00:00:41,560 --> 00:00:43,741
有人去捧这个书
18
00:00:43,741 --> 00:00:46,740
翻译翻得好什么之类的
19
00:00:48,260 --> 00:00:50,339
我们前面也讲了
20
00:00:50,339 --> 00:00:52,649
是你主动过界
21
00:00:52,649 --> 00:00:54,960
是被人推着过界也好
22
00:00:57,370 --> 00:00:58,985
如果产生后果
23
00:00:58,985 --> 00:01:01,140
那我们就要批评
24
00:01:03,650 --> 00:01:04,720
我们
25
00:01:05,510 --> 00:01:06,790
评点的
26
00:01:07,500 --> 00:01:11,120
第一个,是以第10章的第1段开头的
27
00:01:13,410 --> 00:01:18,179
那为什么是第10章的第1段,不是按顺序这样来
28
00:01:18,179 --> 00:01:20,130
是不是前面没问题
29
00:01:20,130 --> 00:01:22,948
然后你找了半天就挑出第10章
30
00:01:22,948 --> 00:01:23,599
有毛病
31
00:01:23,599 --> 00:01:24,900
不是这样的
32
00:01:25,740 --> 00:01:27,620
到处都有毛病
33
00:01:27,900 --> 00:01:28,073
34
00:01:28,073 --> 00:01:28,594
你不信
35
00:01:28,594 --> 00:01:32,586
我们后面还可以继续讲整本书的第1段有什么问题
36
00:01:32,586 --> 00:01:34,670
这个我都已经写了文章了
37
00:01:34,670 --> 00:01:36,232
而且写了一大堆(口误:篇)文章
38
00:01:36,232 --> 00:01:37,794
光这一段的话
39
00:01:37,794 --> 00:01:40,051
我就啪啪啪啪写了很多
40
00:01:40,051 --> 00:01:41,440
这里面有什么问题
41
00:01:43,020 --> 00:01:44,883
还有第1章第1段
42
00:01:44,883 --> 00:01:46,980
这里表达有什么问题
43
00:01:47,260 --> 00:01:47,930
44
00:01:48,850 --> 00:01:50,860
译者这样写有什么不对
45
00:01:52,450 --> 00:01:53,471
都可以讲
46
00:01:53,471 --> 00:01:56,537
但是我们为什么要以第10章这个来讲
47
00:01:56,537 --> 00:01:58,990
因为第10章的内容,我之前写过
48
00:01:59,580 --> 00:02:00,256
文章的
49
00:02:00,256 --> 00:02:05,220
而这个文章本身是从别的文章引用到了相关的知识
50
00:02:05,220 --> 00:02:09,506
所以顺便就写了第10章这个地方的一些知识点
51
00:02:09,506 --> 00:02:09,732
52
00:02:09,732 --> 00:02:11,536
那个素材是现成的
53
00:02:11,536 --> 00:02:11,762
54
00:02:11,762 --> 00:02:16,500
所以我就先把已经有的那个内容先做成视频
55
00:02:16,780 --> 00:02:19,190
后面有时间我们可以
56
00:02:19,840 --> 00:02:20,390
有时间
57
00:02:20,390 --> 00:02:21,675
如果大家感兴趣
58
00:02:21,675 --> 00:02:23,510
我们可以慢慢来评点
59
00:02:23,960 --> 00:02:25,290
背后有什么问题
60
00:02:26,510 --> 00:02:31,370
那这个评点里面,重点不是英文、中文或者翻译问题
61
00:02:31,820 --> 00:02:34,440
是软件开发知识问题
62
00:02:34,720 --> 00:02:37,386
并不是说我软件开发其实很牛
63
00:02:37,386 --> 00:02:38,910
我中文差或英文差
64
00:02:39,370 --> 00:02:40,670
翻译错了
65
00:02:41,210 --> 00:02:42,660
如果是这样
66
00:02:43,600 --> 00:02:45,280
那还可以理解
67
00:02:45,810 --> 00:02:47,670
但暴露的问题
68
00:02:47,950 --> 00:02:50,780
很可能并不是什么英文中文的问题
69
00:02:51,650 --> 00:02:53,352
最后再声明
70
00:02:53,352 --> 00:02:55,480
就是说,我批评这个译文
71
00:02:56,000 --> 00:02:58,241
不代表我赞同原文
72
00:02:58,241 --> 00:03:01,229
并不是说,领域驱动设计
73
00:03:01,229 --> 00:03:03,470
中国人写的就批评
74
00:03:03,750 --> 00:03:05,154
如果是老外写的
75
00:03:05,154 --> 00:03:06,157
就赞同
76
00:03:06,157 --> 00:03:07,160
不是这样的
77
00:03:08,110 --> 00:03:12,650
这整个圈子里面就是很多很多的伪创新
78
00:03:13,020 --> 00:03:17,070
特别很多造词都是老外造出来的
79
00:03:17,620 --> 00:03:17,896
80
00:03:17,896 --> 00:03:19,280
来霍霍大家
81
00:03:21,430 --> 00:03:24,602
国内的人只是跟风而已
82
00:03:24,602 --> 00:03:27,042
不代表我赞同原文
83
00:03:27,042 --> 00:03:27,530
当然
84
00:03:28,650 --> 00:03:31,500
从这个书的质量来说
85
00:03:32,100 --> 00:03:34,411
Vernon这个书的用词
86
00:03:34,411 --> 00:03:37,879
包括这个知识的表达上
87
00:03:37,879 --> 00:03:40,480
要比Evans的那本书
88
00:03:40,760 --> 00:03:41,655
要严谨
89
00:03:41,655 --> 00:03:44,790
这我在几个文章里面也提到过的
90
00:03:45,520 --> 00:03:48,270
或者说,这两个作者相比
91
00:03:49,000 --> 00:03:50,520
Vernon的水平
92
00:03:51,570 --> 00:03:53,140
要更高一点
93
00:03:53,710 --> 00:03:54,960
素养
94
00:03:55,240 --> 00:03:56,800
要更加扎实
0
00:00:00,810 --> 00:00:04,150
那首先我们先来看这个第10章
1
00:00:06,770 --> 00:00:09,690
aggregates正文的第1段
2
00:00:10,740 --> 00:00:11,265
3
00:00:11,265 --> 00:00:12,840
上面是
4
00:00:13,490 --> 00:00:14,190
原文
5
00:00:14,190 --> 00:00:16,290
下面是中译本的译文
6
00:00:18,120 --> 00:00:20,440
中译本的这里
7
00:00:20,720 --> 00:00:22,340
我加了一个下划线
8
00:00:22,710 --> 00:00:23,068
9
00:00:23,068 --> 00:00:24,860
这是第一个
10
00:00:25,980 --> 00:00:27,674
第一句要评点的
11
00:00:27,674 --> 00:00:29,580
这是第二句要评点的
12
00:00:31,390 --> 00:00:32,420
我们来看看
13
00:00:33,250 --> 00:00:34,602
原文是这样
14
00:00:34,602 --> 00:00:35,730
翻译是这样
15
00:00:36,010 --> 00:00:37,100
原文是这样
16
00:00:37,100 --> 00:00:38,190
翻译是这样
17
00:00:40,210 --> 00:00:42,570
那我们看,这个翻译背后
18
00:00:43,370 --> 00:00:45,460
暴露出什么样的问题呢
19
00:00:47,260 --> 00:00:48,650
我们一个一个来看
20
00:00:48,650 --> 00:00:49,520
我们先来看
21
00:00:49,900 --> 00:00:50,970
第一个
22
00:00:58,050 --> 00:01:00,533
第一个,原文是这样说的
23
00:01:00,533 --> 00:01:02,340
24
00:01:03,170 --> 00:01:04,860
译文是这样说的
0
00:00:01,330 --> 00:00:02,830
这里面的问题呢
1
00:00:03,690 --> 00:00:05,096
有这么两个
2
00:00:05,096 --> 00:00:05,800
第一个
3
00:00:07,770 --> 00:00:09,360
共享父类
4
00:00:11,220 --> 00:00:12,370
的对象
5
00:00:12,680 --> 00:00:12,933
6
00:00:12,933 --> 00:00:14,200
这样的说法
7
00:00:15,700 --> 00:00:15,925
8
00:00:15,925 --> 00:00:17,050
是有问题的
9
00:00:18,600 --> 00:00:20,690
还有呢,对象树
10
00:00:23,320 --> 00:00:25,630
这样的说法也是有问题的
11
00:00:26,070 --> 00:00:26,889
跟原文
12
00:00:26,889 --> 00:00:28,801
首先,原文没有
13
00:00:28,801 --> 00:00:31,260
这是译者臆想出来的
14
00:00:32,390 --> 00:00:32,670
15
00:00:32,670 --> 00:00:36,320
这个臆想背后就暴露出了一些
16
00:00:36,640 --> 00:00:38,110
在知识上的
17
00:00:38,530 --> 00:00:40,310
认识上的一些问题
18
00:00:41,300 --> 00:00:41,622
19
00:00:41,622 --> 00:00:43,880
第二个,关联
20
00:00:44,220 --> 00:00:45,820
这里没有说关联
21
00:00:46,580 --> 00:00:48,100
原文没有说关联
22
00:00:48,100 --> 00:00:49,838
只是说相关,结果呢
23
00:00:49,838 --> 00:00:52,010
译者就把它说成了关联
24
00:00:52,550 --> 00:00:54,300
这两个不是一回事
25
00:00:56,560 --> 00:00:58,350
那我们一个一个来看
26
00:01:00,170 --> 00:01:01,050
第一个
27
00:01:02,110 --> 00:01:04,990
共享父类的对象,对象树
28
00:01:05,450 --> 00:01:07,491
那这样的翻译
29
00:01:07,491 --> 00:01:08,950
或者这样的表达
30
00:01:09,620 --> 00:01:13,400
混淆了类和对象的区别
0
00:00:00,390 --> 00:00:01,450
译者
1
00:00:02,300 --> 00:00:04,920
可能分不清类和对象
2
00:00:05,210 --> 00:00:07,920
分不清集合和个体
3
00:00:08,600 --> 00:00:11,740
他误以为这个Parent
4
00:00:11,740 --> 00:00:13,310
这个是父类
5
00:00:13,590 --> 00:00:14,830
或者说超类
6
00:00:15,640 --> 00:00:15,871
7
00:00:15,871 --> 00:00:19,350
实际上是整体对象,是一个对象
8
00:00:21,180 --> 00:00:23,885
产生这样的误认之后呢
9
00:00:23,885 --> 00:00:26,320
他就臆想出共享父类
10
00:00:27,410 --> 00:00:28,230
11
00:00:28,600 --> 00:00:29,860
共享父类
12
00:00:30,750 --> 00:00:34,800
就是继承或者泛化的一棵树
13
00:00:34,800 --> 00:00:37,659
如果超类只有一个的话
14
00:00:37,659 --> 00:00:39,088
单继承的话
15
00:00:39,088 --> 00:00:39,803
16
00:00:39,803 --> 00:00:40,280
17
00:00:40,580 --> 00:00:43,340
继承的形状就是一棵树
18
00:00:43,340 --> 00:00:46,100
所以呢,他就臆想出一个
19
00:00:46,380 --> 00:00:47,610
对象树
20
00:00:48,260 --> 00:00:48,483
21
00:00:48,483 --> 00:00:50,045
这样的一个概念
22
00:00:50,045 --> 00:00:53,169
但实际上原文根本就没有这个
23
00:00:53,169 --> 00:00:55,401
这个是整体对象的意思
24
00:00:55,401 --> 00:00:57,410
而且这里说的是什么
25
00:00:58,250 --> 00:00:59,880
图
26
00:00:59,880 --> 00:01:01,510
对象图
27
00:01:01,880 --> 00:01:03,350
不是对象树
0
00:00:01,350 --> 00:00:02,670
那说到这个
1
00:00:02,670 --> 00:00:05,840
我们就要把道理给讲一讲
2
00:00:07,570 --> 00:00:09,830
我们通常说到一个概念
3
00:00:11,390 --> 00:00:14,600
往往它有两个含义
4
00:00:14,600 --> 00:00:15,670
第一个
5
00:00:16,300 --> 00:00:19,600
它代表的是所有实例的集合
6
00:00:20,570 --> 00:00:23,980
比如说,动物有鼠有鸭
7
00:00:25,480 --> 00:00:25,708
8
00:00:25,708 --> 00:00:28,220
这个就是一个集合的关系
9
00:00:29,510 --> 00:00:31,420
动物有鼠有鸭
10
00:00:32,100 --> 00:00:34,038
意思并不是说,一个动物
11
00:00:34,038 --> 00:00:35,588
我随便挑一个动物
12
00:00:35,588 --> 00:00:36,170
比如说
13
00:00:36,780 --> 00:00:38,590
就拿我来说
14
00:00:39,250 --> 00:00:41,632
然后我是由一只老鼠
15
00:00:41,632 --> 00:00:45,206
若干只老鼠跟若干只鸭组装而成的
16
00:00:45,206 --> 00:00:46,160
不是的
17
00:00:46,440 --> 00:00:48,160
它是说集合
18
00:00:48,440 --> 00:00:50,310
动物实例的集合
19
00:00:50,940 --> 00:00:54,300
就包含了鼠的实例的集合
20
00:00:54,610 --> 00:00:56,878
以及鸭的实例的集合
21
00:00:56,878 --> 00:00:58,390
这是集合的包含
22
00:01:01,630 --> 00:01:02,660
第二个
23
00:01:03,820 --> 00:01:05,790
它有可能是指代
24
00:01:06,140 --> 00:01:08,420
集合中的任意一个实例
25
00:01:11,150 --> 00:01:14,710
比如说,鼠有头有颈
26
00:01:17,630 --> 00:01:19,223
这个就不是集合了
27
00:01:19,223 --> 00:01:20,020
并不是说
28
00:01:20,600 --> 00:01:22,130
老鼠的集合
29
00:01:22,410 --> 00:01:25,800
包含了所有头和脖子的集合
30
00:01:26,660 --> 00:01:30,740
或者说,头跟脖子是老鼠的一种
31
00:01:31,110 --> 00:01:33,110
不一定,没准这个脖子是
32
00:01:33,450 --> 00:01:34,970
是属于
33
00:01:35,270 --> 00:01:37,123
属于鸭的脖子
34
00:01:37,123 --> 00:01:38,050
对不对
35
00:01:38,330 --> 00:01:39,070
36
00:01:40,200 --> 00:01:41,868
人也有脖子
37
00:01:41,868 --> 00:01:42,425
对吧
38
00:01:42,425 --> 00:01:44,093
头,人也有头
39
00:01:44,093 --> 00:01:44,650
对吧
40
00:01:45,820 --> 00:01:49,050
鼠有头有颈,是什么意思
41
00:01:49,410 --> 00:01:53,428
你随便,任意挑出一个老鼠的实例
42
00:01:53,428 --> 00:01:54,290
比如说
43
00:01:54,570 --> 00:01:56,320
它
44
00:01:58,030 --> 00:02:02,450
我敢肯定,它是有头有脖子的
45
00:02:03,000 --> 00:02:03,710
46
00:02:03,990 --> 00:02:05,515
它是个体的组装
47
00:02:05,515 --> 00:02:07,040
一只老鼠
48
00:02:07,320 --> 00:02:10,815
它是由若干个头,若干个脖子组成的
49
00:02:10,815 --> 00:02:14,776
当然,我们这里若干,一般老鼠都是1了
50
00:02:14,776 --> 00:02:17,340
一个头,一个脖子组成的
51
00:02:17,970 --> 00:02:20,130
它是个体的组装
52
00:02:22,150 --> 00:02:22,785
显然
53
00:02:22,785 --> 00:02:25,960
我们说的聚合组合关系
54
00:02:26,240 --> 00:02:27,808
比如说,汽车
55
00:02:27,808 --> 00:02:29,900
有四个轮子
56
00:02:30,290 --> 00:02:30,560
57
00:02:30,560 --> 00:02:32,180
有一个发动机
58
00:02:32,460 --> 00:02:32,715
59
00:02:32,715 --> 00:02:36,290
有两扇门什么之类的
60
00:02:36,870 --> 00:02:40,761
这是个体的关系,还是集合关系
61
00:02:40,761 --> 00:02:42,592
这是个体的关系
62
00:02:42,592 --> 00:02:43,278
对不对
63
00:02:43,278 --> 00:02:47,170
它是对象级别的,你指定任何一个汽车
64
00:02:47,650 --> 00:02:48,370
65
00:02:48,650 --> 00:02:54,150
它是由一个发动机、四个轮子什么之类组装而成的
66
00:02:57,430 --> 00:02:59,390
而译者怎么样
67
00:02:59,750 --> 00:03:03,790
就把它混淆成了集合关系了
68
00:03:04,070 --> 00:03:06,440
以为是说共享父类
69
00:03:07,360 --> 00:03:08,402
那是动物
70
00:03:08,402 --> 00:03:11,010
有鼠有鸭,这个才是的
71
00:03:14,880 --> 00:03:16,810
那我们用图来表示一下
72
00:03:16,810 --> 00:03:18,039
大家看得更清楚
73
00:03:18,039 --> 00:03:18,390
你看
74
00:03:19,230 --> 00:03:20,390
BC
75
00:03:20,750 --> 00:03:23,390
泛化到A或者BC继承A
76
00:03:23,670 --> 00:03:24,890
含义是什么
77
00:03:25,250 --> 00:03:28,481
A的实例集合或者A的对象集合
78
00:03:28,481 --> 00:03:30,790
包含了BC的对象集合
79
00:03:31,430 --> 00:03:32,180
对不对
80
00:03:36,120 --> 00:03:37,732
而个体是什么
81
00:03:37,732 --> 00:03:40,687
A关联到BC,意味着什么
82
00:03:40,687 --> 00:03:42,300
A里面的个体
83
00:03:43,360 --> 00:03:45,640
和BC里面的个体
84
00:03:46,330 --> 00:03:47,820
发生了关系
85
00:03:49,040 --> 00:03:50,682
只有个体的关系
86
00:03:50,682 --> 00:03:55,140
才会有一对多、多对多之类的
87
00:03:55,600 --> 00:03:57,899
集合哪里有什么一对多、多对多
88
00:03:57,899 --> 00:03:58,430
对不对
89
00:03:58,710 --> 00:04:00,240
本来它是一个集合
90
00:04:02,960 --> 00:04:05,740
而聚合组合就相当于什么
91
00:04:06,020 --> 00:04:09,929
这个BC的个体就把它装到A的个体里面去了
92
00:04:09,929 --> 00:04:12,350
就把它看作是A里面的一部分
93
00:04:12,830 --> 00:04:13,092
94
00:04:13,092 --> 00:04:14,930
但它的类型是
95
00:04:15,310 --> 00:04:16,550
B和C
96
00:04:20,390 --> 00:04:21,370
所以呢
97
00:04:22,060 --> 00:04:24,290
译者想象的树
98
00:04:24,290 --> 00:04:26,520
实际上是类的树
99
00:04:29,190 --> 00:04:31,041
转成对象集合的表达
100
00:04:31,041 --> 00:04:33,920
实际上它是一个集合的关系
101
00:04:33,920 --> 00:04:35,360
根本就不是什么
102
00:04:35,740 --> 00:04:37,540
不是一个老鼠
103
00:04:37,540 --> 00:04:40,240
有脖子,有头,这个关系
104
00:04:40,240 --> 00:04:42,640
那是个体的关系
105
00:04:46,160 --> 00:04:48,130
他把这两个搞混了
106
00:04:48,570 --> 00:04:48,855
107
00:04:48,855 --> 00:04:52,854
所以才会衍生出什么对象树
108
00:04:52,854 --> 00:04:55,710
类似这样的一些表达
109
00:05:00,480 --> 00:05:03,200
那什么样的表达是合适的
110
00:05:03,570 --> 00:05:05,278
上面三个都可以
111
00:05:05,278 --> 00:05:06,010
比如说
112
00:05:06,290 --> 00:05:07,960
共享父类的类
113
00:05:09,000 --> 00:05:12,480
这可以,比如说鼠和鸭
114
00:05:13,000 --> 00:05:15,330
它们的父类都是动物
115
00:05:16,590 --> 00:05:18,430
这可以
116
00:05:20,680 --> 00:05:22,849
或者说,类的对象,可以
117
00:05:22,849 --> 00:05:23,500
比如说
118
00:05:24,620 --> 00:05:26,620
对象9527
119
00:05:26,940 --> 00:05:29,290
是一个鼠的对象
120
00:05:29,950 --> 00:05:30,360
121
00:05:30,360 --> 00:05:32,820
对象666是
122
00:05:33,130 --> 00:05:34,370
鸭的对象
123
00:05:34,660 --> 00:05:34,841
124
00:05:34,841 --> 00:05:36,471
就是说,它是一只老鼠
125
00:05:36,471 --> 00:05:37,740
它是一只鸭子了
126
00:05:38,020 --> 00:05:39,240
这个也可以
127
00:05:39,940 --> 00:05:43,596
或者说共享父类的类的对象
128
00:05:43,596 --> 00:05:46,128
这个虽然有点别扭
129
00:05:46,128 --> 00:05:47,816
但是也可以的
130
00:05:47,816 --> 00:05:48,660
比如说
131
00:05:49,190 --> 00:05:53,880
我家里面开了一个小小的动物园
132
00:05:54,410 --> 00:05:56,860
动物园里面呢有
133
00:05:57,950 --> 00:05:59,480
两只老鼠
134
00:05:59,760 --> 00:06:00,031
135
00:06:00,031 --> 00:06:00,846
一只鸭
136
00:06:00,846 --> 00:06:03,290
这样也能说得通
137
00:06:06,240 --> 00:06:09,197
但是不能直接说共享父类的对象
138
00:06:09,197 --> 00:06:10,380
这是不对的
139
00:06:11,020 --> 00:06:12,160
对象怎么共享父类
140
00:06:12,160 --> 00:06:14,440
对象的本身就是一个类
141
00:06:14,820 --> 00:06:17,156
只能是一个类的实例
142
00:06:17,156 --> 00:06:17,740
对不对
143
00:06:18,020 --> 00:06:20,379
你可以说,这个类又属于另外一个类的(子类)
144
00:06:20,379 --> 00:06:21,490
你说,我是一只老鼠
145
00:06:21,810 --> 00:06:22,041
146
00:06:22,041 --> 00:06:23,660
这个没问题
147
00:06:25,110 --> 00:06:25,734
然后呢
148
00:06:25,734 --> 00:06:28,647
老鼠这个概念,它属于动物的一种
149
00:06:28,647 --> 00:06:29,479
那是什么
150
00:06:29,479 --> 00:06:31,560
那是类级别上的
151
00:06:31,860 --> 00:06:33,710
你说,你是哪个类的对象
152
00:06:33,710 --> 00:06:36,855
就是那个,不存在共享父类的对象这些说法
153
00:06:36,855 --> 00:06:38,890
没有这个的
154
00:06:44,370 --> 00:06:45,620
这是第一个了
155
00:06:46,260 --> 00:06:49,770
那第二个问题就是说关联的问题
156
00:06:49,770 --> 00:06:52,110
那这个我们下期再说了