WEBVTT

1
00:00:00.080 --> 00:00:02.520
<v Speaker 1>So if you tell your web browser to subtract the

2
00:00:02.640 --> 00:00:06.240
<v Speaker 1>number one from the word five like text that actually

3
00:00:06.320 --> 00:00:09.039
<v Speaker 1>spells out the number five, it somehow gives you the

4
00:00:09.119 --> 00:00:09.759
<v Speaker 1>number four.

5
00:00:09.759 --> 00:00:13.279
<v Speaker 2>Right, which logically makes absolutely no sense, none at all.

6
00:00:13.480 --> 00:00:15.599
<v Speaker 1>But wait, if you tell it to add the number

7
00:00:15.640 --> 00:00:18.480
<v Speaker 1>one to the text five, it suddenly gives you fifty one.

8
00:00:18.640 --> 00:00:21.760
<v Speaker 2>Yeah, it just glues them together. It's wild, It really is.

9
00:00:22.399 --> 00:00:25.879
<v Speaker 1>So. Welcome to the deep dive today. Our mission is

10
00:00:25.920 --> 00:00:28.920
<v Speaker 1>to basically decode what on earth is happening behind the

11
00:00:28.920 --> 00:00:31.600
<v Speaker 1>glass of your screens. You know, we really want to

12
00:00:31.600 --> 00:00:37.240
<v Speaker 1>demystify this incredibly powerful, but honestly slightly alien world of

13
00:00:37.320 --> 00:00:38.240
<v Speaker 1>computer programming.

14
00:00:38.280 --> 00:00:40.320
<v Speaker 2>And it is alien. I mean, we are surrounded by

15
00:00:40.320 --> 00:00:43.119
<v Speaker 2>these machines constantly, right, We're carrying them in our pockets,

16
00:00:43.159 --> 00:00:46.560
<v Speaker 2>We're wearing them on our wrisks, yeah, everywhere exactly. Yet

17
00:00:46.600 --> 00:00:49.280
<v Speaker 2>for most people, the actual mechanism of how we talk

18
00:00:49.320 --> 00:00:52.840
<v Speaker 2>to them, it re means completely opaque. We just tap

19
00:00:52.880 --> 00:00:55.320
<v Speaker 2>a colorful little icon and just, you know, hope the

20
00:00:55.359 --> 00:00:56.399
<v Speaker 2>machine understands our.

21
00:00:56.320 --> 00:00:59.280
<v Speaker 1>Intent, which is exactly why we are diving into some

22
00:00:59.320 --> 00:01:03.399
<v Speaker 1>excerpts from truly fascinating source today. We're looking at the

23
00:01:03.439 --> 00:01:08.079
<v Speaker 1>acclaimed book Eloquent JavaScript second edition by Marine Haverbak.

24
00:01:08.200 --> 00:01:09.040
<v Speaker 2>It's a great choice.

25
00:01:09.120 --> 00:01:11.680
<v Speaker 1>Yeah, it is, because what makes this material really stand

26
00:01:11.719 --> 00:01:14.319
<v Speaker 1>out is that it's not it's not just some dry

27
00:01:14.519 --> 00:01:17.280
<v Speaker 1>technical manual about like writing web code.

28
00:01:17.359 --> 00:01:18.040
<v Speaker 2>No, not at all.

29
00:01:18.079 --> 00:01:21.640
<v Speaker 1>It reads much more like a well, a philosophical exploration.

30
00:01:21.799 --> 00:01:22.079
<v Speaker 2>Really.

31
00:01:22.359 --> 00:01:25.640
<v Speaker 1>It looks at how we bridge this massive communication gap

32
00:01:25.680 --> 00:01:30.439
<v Speaker 1>between us, you know, squishy biological organisms who excel at

33
00:01:30.480 --> 00:01:35.159
<v Speaker 1>social and spatial reasoning and these completely unfeeling manipulators of

34
00:01:35.239 --> 00:01:36.159
<v Speaker 1>meaningless data.

35
00:01:36.359 --> 00:01:39.439
<v Speaker 2>Yeah, the author frames that disconnect so perfectly. I mean,

36
00:01:39.560 --> 00:01:42.599
<v Speaker 2>think about human intelligence for a second. Okay, we constantly

37
00:01:42.640 --> 00:01:46.840
<v Speaker 2>rely on context, nuance, social cues just to understand each other.

38
00:01:47.120 --> 00:01:50.159
<v Speaker 2>Computers have absolutely none of that, zero, right, They don't

39
00:01:50.159 --> 00:01:53.079
<v Speaker 2>inherently understand the concept of like a photo or a

40
00:01:53.120 --> 00:01:56.439
<v Speaker 2>bank account. They just shuffle data around based on these

41
00:01:56.599 --> 00:01:58.920
<v Speaker 2>incredibly rigid, unthinking rules.

42
00:01:59.239 --> 00:02:02.000
<v Speaker 1>So we have to basically build a bridge to interact

43
00:02:02.040 --> 00:02:04.239
<v Speaker 1>with them. And looking at the history of it all,

44
00:02:04.280 --> 00:02:06.319
<v Speaker 1>we kind of settled on two different approaches.

45
00:02:06.439 --> 00:02:07.599
<v Speaker 2>Yeah, that's a good way to put it.

46
00:02:07.640 --> 00:02:11.120
<v Speaker 1>The first approach, it relies heavily on our human talent

47
00:02:11.199 --> 00:02:15.560
<v Speaker 1>for spatial reasoning, like we build graphical interfaces. We literally

48
00:02:15.639 --> 00:02:18.080
<v Speaker 1>draw a little folders on the screen. We swipe, we

49
00:02:18.199 --> 00:02:21.599
<v Speaker 1>pin exactly, we drag and drop things into a virtual

50
00:02:21.639 --> 00:02:22.199
<v Speaker 1>trash can.

51
00:02:22.599 --> 00:02:25.159
<v Speaker 2>And I mean it makes perfect sense why that approach

52
00:02:25.240 --> 00:02:28.759
<v Speaker 2>won the mainstream, right. It makes the computer feel approachable,

53
00:02:29.000 --> 00:02:30.319
<v Speaker 2>almost physical in a way.

54
00:02:30.439 --> 00:02:30.680
<v Speaker 1>Right.

55
00:02:31.319 --> 00:02:34.479
<v Speaker 2>But there is a hidden cost to all that convenience,

56
00:02:34.840 --> 00:02:37.319
<v Speaker 2>because when you rely entirely on a point and click

57
00:02:37.400 --> 00:02:41.680
<v Speaker 2>graphical interface, your power is strictly limited to the imagination

58
00:02:41.759 --> 00:02:43.319
<v Speaker 2>of the person who designed that interface.

59
00:02:43.400 --> 00:02:44.479
<v Speaker 1>Oh that's a really good point.

60
00:02:44.599 --> 00:02:46.800
<v Speaker 2>Yeah. You can only click the specific buttons they decided

61
00:02:46.800 --> 00:02:49.319
<v Speaker 2>to draw for you, you know, and only in the

62
00:02:49.360 --> 00:02:51.039
<v Speaker 2>exact ways they allow you to click them.

63
00:02:51.199 --> 00:02:54.199
<v Speaker 1>Let's ground this in like a real world scenario for

64
00:02:54.240 --> 00:02:58.039
<v Speaker 1>a second. Interacting with a computer purely through a graphical

65
00:02:58.080 --> 00:03:01.759
<v Speaker 1>interface is basically like going to a restaurant and ordering

66
00:03:01.800 --> 00:03:03.800
<v Speaker 1>off a fixed printed menu.

67
00:03:04.120 --> 00:03:05.520
<v Speaker 2>Okay, yeah, I like that, right.

68
00:03:05.719 --> 00:03:07.879
<v Speaker 1>You can choose the chicken, or you can choose the steak.

69
00:03:07.960 --> 00:03:10.280
<v Speaker 1>You can maybe ask for the dressing on the side

70
00:03:10.479 --> 00:03:12.599
<v Speaker 1>if they let you, exactly if they let you. But

71
00:03:12.719 --> 00:03:15.199
<v Speaker 1>if you suddenly decide, hey, I want a fusion dish

72
00:03:15.199 --> 00:03:18.360
<v Speaker 1>that isn't on the page, well, you are completely out

73
00:03:18.360 --> 00:03:18.759
<v Speaker 1>of luck.

74
00:03:19.240 --> 00:03:22.719
<v Speaker 2>That captures the limitation perfectly. You're trapped by the menu.

75
00:03:22.520 --> 00:03:26.199
<v Speaker 1>But learning a programming language that feels like, I don't know,

76
00:03:26.319 --> 00:03:30.000
<v Speaker 1>sneaking past the wait staff, walking straight into the restaurant's kitchen,

77
00:03:30.280 --> 00:03:32.879
<v Speaker 1>finding where they keep all the raw ingredients, the pans,

78
00:03:32.919 --> 00:03:35.599
<v Speaker 1>the spices, and just cooking whatever your heart desires.

79
00:03:35.840 --> 00:03:38.560
<v Speaker 2>Yeah, taking control of the kitchen is the ultimate goal here,

80
00:03:39.000 --> 00:03:43.400
<v Speaker 2>because to instruct a computer to perform truly open ended

81
00:03:43.719 --> 00:03:48.080
<v Speaker 2>mavel tasks, you know, clicking buttons will never be enough. Right,

82
00:03:48.280 --> 00:03:50.439
<v Speaker 2>We have to lean into our most powerful tool for

83
00:03:50.520 --> 00:03:54.879
<v Speaker 2>abstract thought, which is language itself. Teaching a machine a

84
00:03:55.000 --> 00:03:58.879
<v Speaker 2>language bypasses that fixed menu completely.

85
00:03:58.439 --> 00:04:01.759
<v Speaker 1>Which honestly makes me wonder if if the shift to

86
00:04:01.879 --> 00:04:06.280
<v Speaker 1>those incredibly easy, beautifully designed graphical interfaces actually made us

87
00:04:06.319 --> 00:04:09.759
<v Speaker 1>forget how much raw power we hold over our devices. Oh,

88
00:04:09.759 --> 00:04:13.319
<v Speaker 1>I think it absolutely did, because decades ago, interacting with

89
00:04:13.360 --> 00:04:16.839
<v Speaker 1>a computer meant typing text onto a blank screen. There

90
00:04:16.920 --> 00:04:18.639
<v Speaker 1>was no handholding none.

91
00:04:19.040 --> 00:04:23.240
<v Speaker 2>We definitely traded absolute control for daily convenience, no question.

92
00:04:23.600 --> 00:04:26.600
<v Speaker 2>But the raw power is still sitting right there, you know,

93
00:04:26.839 --> 00:04:30.079
<v Speaker 2>just beneath the glossy surface of every app you use

94
00:04:30.279 --> 00:04:32.879
<v Speaker 2>just waiting to be commanded. Yeah. In fact, the book

95
00:04:32.959 --> 00:04:36.120
<v Speaker 2>highlights a quote from the computer scientist Joseph Weisenbaum that

96
00:04:36.240 --> 00:04:38.839
<v Speaker 2>really sets the stakes for what we're talking about. He wrote,

97
00:04:39.279 --> 00:04:42.920
<v Speaker 2>the computer programmer is a creator of universes for which

98
00:04:42.959 --> 00:04:45.839
<v Speaker 2>he alone is responsible creator of universes.

99
00:04:45.879 --> 00:04:48.759
<v Speaker 1>I mean, wow, you don't usually hear that kind of sweeping,

100
00:04:48.879 --> 00:04:52.199
<v Speaker 1>majestic language applied to like someone typing lines of code

101
00:04:52.240 --> 00:04:53.040
<v Speaker 1>in a dark room.

102
00:04:53.199 --> 00:04:57.680
<v Speaker 2>It sounds grandiose, sure, but it's entirely accurate. Unlike physical engineering,

103
00:04:57.680 --> 00:04:59.720
<v Speaker 2>where you have to worry about gravity, material costs for

104
00:05:00.000 --> 00:05:00.319
<v Speaker 2>and all.

105
00:05:00.240 --> 00:05:02.240
<v Speaker 1>That stuff real world problems, right.

106
00:05:02.120 --> 00:05:05.079
<v Speaker 2>A computer program is completely costless to build. It is

107
00:05:05.120 --> 00:05:09.240
<v Speaker 2>literally weightless. It grows and expands under your typing hands

108
00:05:09.439 --> 00:05:12.839
<v Speaker 2>out of pure thought. Yeah, you are quite literally building

109
00:05:12.879 --> 00:05:17.040
<v Speaker 2>a microscopic universe with virtually unlimited complexity.

110
00:05:17.399 --> 00:05:21.360
<v Speaker 1>But a universe built out of pure thought sounds incredibly

111
00:05:21.399 --> 00:05:24.959
<v Speaker 1>difficult to manage, like there's no physical scaffolding to keep

112
00:05:25.000 --> 00:05:27.759
<v Speaker 1>it from collapsing in on itself exactly. And in the

113
00:05:27.759 --> 00:05:30.560
<v Speaker 1>source material, the author even brings in a quote from

114
00:05:30.720 --> 00:05:33.560
<v Speaker 1>Confucius to sort of warn us about this learning process.

115
00:05:33.839 --> 00:05:37.399
<v Speaker 1>Confucius basically says uh, If I show you one corner

116
00:05:37.439 --> 00:05:39.519
<v Speaker 1>of a square, you need to be anxious to go

117
00:05:39.680 --> 00:05:41.360
<v Speaker 1>find the other three corners yourself.

118
00:05:41.439 --> 00:05:43.079
<v Speaker 2>Yeah, he's setting expectations right.

119
00:05:43.120 --> 00:05:46.000
<v Speaker 1>The author is giving us a heads up that digesting

120
00:05:46.040 --> 00:05:50.240
<v Speaker 1>this material and building these universes it takes intense mental effort.

121
00:05:50.319 --> 00:05:53.000
<v Speaker 1>It's like you're building a massive mental maze.

122
00:05:53.160 --> 00:05:55.560
<v Speaker 2>The real danger of building a massive mental maze out

123
00:05:55.600 --> 00:05:58.800
<v Speaker 2>of pure thought is that you can very easily get

124
00:05:58.879 --> 00:06:01.279
<v Speaker 2>lost in it yourself. The complexity will just grow out

125
00:06:01.319 --> 00:06:02.720
<v Speaker 2>of control if you aren't careful.

126
00:06:02.800 --> 00:06:03.879
<v Speaker 1>So it's not just about typing.

127
00:06:04.600 --> 00:06:06.920
<v Speaker 2>No, the true art of programming isn't really about typing

128
00:06:06.959 --> 00:06:09.040
<v Speaker 2>the right words at all. It is the art of

129
00:06:09.079 --> 00:06:10.199
<v Speaker 2>controlling complexity.

130
00:06:10.439 --> 00:06:13.519
<v Speaker 1>Okay, So to control that complexity, we obviously have to

131
00:06:13.519 --> 00:06:15.399
<v Speaker 1>start with the raw building blocks. We have to wade

132
00:06:15.439 --> 00:06:18.360
<v Speaker 1>into what the book calls the sea of bits, and

133
00:06:18.399 --> 00:06:20.240
<v Speaker 1>the scale of this is just hard to wrap your

134
00:06:20.240 --> 00:06:23.519
<v Speaker 1>head around. A typical modern computer has more than thirty

135
00:06:23.560 --> 00:06:27.000
<v Speaker 1>billion bits floating around in its volatile working memory.

136
00:06:26.959 --> 00:06:31.800
<v Speaker 2>Thirty billion individual points of data and the bit it's

137
00:06:31.839 --> 00:06:35.079
<v Speaker 2>the smallest conceivable unit of information. It only has two states,

138
00:06:35.240 --> 00:06:38.040
<v Speaker 2>like on or off exactly. Think of it as a

139
00:06:38.079 --> 00:06:42.279
<v Speaker 2>microscopic electrical switch that is either said to high or low.

140
00:06:43.000 --> 00:06:46.279
<v Speaker 2>We represent those states conceptually as a one or a zero.

141
00:06:47.120 --> 00:06:48.879
<v Speaker 2>And that is all. It is just an ocean of

142
00:06:48.920 --> 00:06:49.680
<v Speaker 2>binary noise.

143
00:06:49.759 --> 00:06:52.319
<v Speaker 1>Okay, but of everything is just an ocean of identical

144
00:06:52.399 --> 00:06:55.560
<v Speaker 1>electrical charges. How does the computer know when a specific

145
00:06:55.639 --> 00:06:57.480
<v Speaker 1>group of bits is supposed to be I don't know

146
00:06:57.519 --> 00:07:00.720
<v Speaker 1>a number or a letter or a color like JavaScript

147
00:07:00.759 --> 00:07:03.399
<v Speaker 1>would have to build fences inside that ocean.

148
00:07:03.759 --> 00:07:06.720
<v Speaker 2>Building fences is exactly how it imposes order on the chaos.

149
00:07:07.240 --> 00:07:10.439
<v Speaker 2>JavaScript takes that endless sea of thirty billion bits and

150
00:07:10.519 --> 00:07:13.720
<v Speaker 2>chunks them into organized, manageable pieces of information. It calls

151
00:07:13.759 --> 00:07:17.120
<v Speaker 2>them values value, and every single value you create is

152
00:07:17.120 --> 00:07:20.279
<v Speaker 2>assigned a specific type, which then dictates exactly how the

153
00:07:20.279 --> 00:07:21.879
<v Speaker 2>computer's allowed to interact with it.

154
00:07:22.120 --> 00:07:24.079
<v Speaker 1>Let's look closely at the number type then, because I

155
00:07:24.079 --> 00:07:27.000
<v Speaker 1>think this really illustrates how the physical reality of the

156
00:07:27.040 --> 00:07:31.000
<v Speaker 1>machine actually limits the theoretical math it does. JavaScript draws

157
00:07:31.040 --> 00:07:34.560
<v Speaker 1>a very specific fence for numbers. Right, It uses exactly

158
00:07:34.600 --> 00:07:38.199
<v Speaker 1>sixty four bits to store a single number value.

159
00:07:37.879 --> 00:07:41.399
<v Speaker 2>Meaning you have a physical container with exactly sixty four slots.

160
00:07:41.759 --> 00:07:44.439
<v Speaker 2>Each slot can hold a one or a zero, And

161
00:07:44.480 --> 00:07:47.560
<v Speaker 2>because it is a fixed physical size, well, there are

162
00:07:47.600 --> 00:07:50.319
<v Speaker 2>only so many combinations of zeros and ones you can generate.

163
00:07:50.600 --> 00:07:54.040
<v Speaker 1>I mean, sixty four bits still provides a massive playground

164
00:07:54.079 --> 00:07:56.439
<v Speaker 1>doing the math on the combinations that gives you the

165
00:07:56.480 --> 00:08:00.519
<v Speaker 1>ability to represent about eighteen quintillion different numbers.

166
00:08:00.600 --> 00:08:03.319
<v Speaker 2>Yeah, that is an eighteen followed by eighteen zeros, which

167
00:08:03.360 --> 00:08:05.600
<v Speaker 2>is huge. It feels like an infinite space, right, Ito

168
00:08:05.600 --> 00:08:07.319
<v Speaker 2>likesy to count higher than you would ever need to

169
00:08:07.360 --> 00:08:11.360
<v Speaker 2>in a lifetime. But it is fundamentally finite, right, not infinite.

170
00:08:11.399 --> 00:08:14.079
<v Speaker 2>And because it is finite, the computer has to make compromises,

171
00:08:14.680 --> 00:08:17.160
<v Speaker 2>especially when you ask it to store fractional numbers like

172
00:08:17.240 --> 00:08:18.759
<v Speaker 2>say nine point eighty one.

173
00:08:19.199 --> 00:08:22.439
<v Speaker 1>And this is where the physical architecture forces the computer

174
00:08:22.480 --> 00:08:24.600
<v Speaker 1>to cheat a little bit, isn't it, Because out of

175
00:08:24.680 --> 00:08:27.680
<v Speaker 1>those sixty four slots, one slot has to be reserved

176
00:08:27.839 --> 00:08:30.720
<v Speaker 1>just to remember if the number is negative, then a

177
00:08:30.759 --> 00:08:32.759
<v Speaker 1>whole chunk of slots has to be used to remember

178
00:08:32.799 --> 00:08:34.360
<v Speaker 1>exactly where the decimal point.

179
00:08:34.200 --> 00:08:38.840
<v Speaker 2>Lives, which leaves even fewer slots for the actual digits. So,

180
00:08:38.960 --> 00:08:40.960
<v Speaker 2>just like the number pi goes on forever and can't

181
00:08:40.960 --> 00:08:44.159
<v Speaker 2>be perfectly written out on a finite piece of paper. Oh,

182
00:08:44.200 --> 00:08:48.039
<v Speaker 2>a computer can't store a complex, infinitely repeating fraction in

183
00:08:48.120 --> 00:08:51.360
<v Speaker 2>a finite sixty four bit container. It physically runs out

184
00:08:51.360 --> 00:08:54.080
<v Speaker 2>of room, so it simply rounds off the end. It

185
00:08:54.120 --> 00:08:57.159
<v Speaker 2>basically just stores a very close approximation of the fraction.

186
00:08:57.399 --> 00:08:59.440
<v Speaker 1>So as a programmer, you kind of have to look

187
00:08:59.480 --> 00:09:02.919
<v Speaker 1>at fraction all digital numbers with a healthy dose of suspicion.

188
00:09:03.080 --> 00:09:06.519
<v Speaker 1>Always they might be off by some microscopic, invisible fraction.

189
00:09:06.759 --> 00:09:09.960
<v Speaker 1>But beyond the standard numbers, a JavaScript includes three special

190
00:09:10.039 --> 00:09:13.000
<v Speaker 1>numbers inside the number type that are essentially like rebels.

191
00:09:13.279 --> 00:09:15.120
<v Speaker 1>They don't follow the rules of normal math.

192
00:09:15.360 --> 00:09:18.440
<v Speaker 2>Yeah. The first two are infinity and infinity, and they

193
00:09:18.480 --> 00:09:23.360
<v Speaker 2>generally behave the way you would expect infinite concepts to behave, right, Like,

194
00:09:23.600 --> 00:09:26.919
<v Speaker 2>if you subtract one from infinity, the result is still infinity.

195
00:09:27.000 --> 00:09:27.399
<v Speaker 1>Makes sense.

196
00:09:27.440 --> 00:09:30.120
<v Speaker 2>But if you start throwing infinity into your equations everywhere,

197
00:09:30.279 --> 00:09:34.399
<v Speaker 2>the math starts getting very wobbly, very quickly, which leads

198
00:09:34.480 --> 00:09:39.399
<v Speaker 2>to the third and probably most notorious special number, NAN, which.

199
00:09:39.240 --> 00:09:42.960
<v Speaker 1>Literally stands for not a number. Okay, I have to

200
00:09:42.960 --> 00:09:45.279
<v Speaker 1>stop and unpack this because it sounds like a cruel joke.

201
00:09:45.519 --> 00:09:46.000
<v Speaker 2>It does.

202
00:09:46.360 --> 00:09:49.600
<v Speaker 1>Why on Earth. Would a programming language explicitly create a

203
00:09:49.720 --> 00:09:53.080
<v Speaker 1>value called not a number and then categorize it inside

204
00:09:53.120 --> 00:09:54.000
<v Speaker 1>the number type.

205
00:09:54.279 --> 00:09:57.080
<v Speaker 2>It sounds like a total paradox. I know, but you'd

206
00:09:57.159 --> 00:09:59.639
<v Speaker 2>have to look at it from the computer's perspective. It

207
00:09:59.679 --> 00:10:01.120
<v Speaker 2>needs a catch all safety net.

208
00:10:01.240 --> 00:10:02.039
<v Speaker 1>A safety net.

209
00:10:02.159 --> 00:10:05.720
<v Speaker 2>Yeah. If you force the computer to calculate something mathematically nonsensical,

210
00:10:05.759 --> 00:10:09.360
<v Speaker 2>like zero divided by zero or infinite minus infinity, it

211
00:10:09.399 --> 00:10:10.919
<v Speaker 2>has to return some kind of result.

212
00:10:11.120 --> 00:10:11.720
<v Speaker 1>Oh, I see.

213
00:10:11.799 --> 00:10:13.960
<v Speaker 2>It can't just return the number seven, because that's a lie.

214
00:10:14.039 --> 00:10:16.639
<v Speaker 2>It can't return a word. It has to output a

215
00:10:16.799 --> 00:10:18.679
<v Speaker 2>value of the number type.

216
00:10:18.480 --> 00:10:22.159
<v Speaker 1>So it returns nan. It's essentially the computer throwing its

217
00:10:22.200 --> 00:10:25.039
<v Speaker 1>hands up in the air, shrugging and saying, hey, I

218
00:10:25.120 --> 00:10:27.360
<v Speaker 1>ran the calculation you asked for, but the result is

219
00:10:27.440 --> 00:10:28.399
<v Speaker 1>complete gibberish.

220
00:10:28.720 --> 00:10:31.360
<v Speaker 2>I tried, but this is nonsense exactly.

221
00:10:31.919 --> 00:10:34.919
<v Speaker 1>It prevents the whole system from crashing just by providing

222
00:10:35.000 --> 00:10:38.039
<v Speaker 1>a safe, predictable output for a broken equation.

223
00:10:38.480 --> 00:10:42.559
<v Speaker 2>Okay. Moving beyond numbers, the language also chunks bits into

224
00:10:42.759 --> 00:10:46.679
<v Speaker 2>other types. We have strings, which are used to represent text.

225
00:10:46.960 --> 00:10:49.519
<v Speaker 2>You wrap your text in quote marks, and you can

226
00:10:49.559 --> 00:10:53.000
<v Speaker 2>glue different strings together, which is a process called concatenation right,

227
00:10:53.519 --> 00:10:56.120
<v Speaker 2>and then you have booleans, which are incredibly simply just

228
00:10:56.240 --> 00:10:58.679
<v Speaker 2>act as logical true or false switches.

229
00:10:59.039 --> 00:11:02.039
<v Speaker 1>You know. Taking a step back, the text provides some

230
00:11:02.200 --> 00:11:05.320
<v Speaker 1>vital historical context that really makes you appreciate all these types.

231
00:11:05.399 --> 00:11:07.679
<v Speaker 2>Oh yeah, the history is fascinating because in.

232
00:11:07.600 --> 00:11:11.159
<v Speaker 1>The early days of computing, decades before JavaScript even existed,

233
00:11:11.519 --> 00:11:14.279
<v Speaker 1>programmers did not have the luxury of just typing a

234
00:11:14.320 --> 00:11:16.080
<v Speaker 1>word or a number. They had to act as the

235
00:11:16.120 --> 00:11:17.759
<v Speaker 1>interface themselves.

236
00:11:17.279 --> 00:11:21.159
<v Speaker 2>Literally flipping switches. Literally, they stood in front of massive

237
00:11:21.240 --> 00:11:26.039
<v Speaker 2>machines and manually flipped large arrays of physical switches or

238
00:11:26.080 --> 00:11:29.679
<v Speaker 2>punch tiny holes in cardboard cards just to feed those

239
00:11:29.720 --> 00:11:32.200
<v Speaker 2>ones and zeros directly into the machine's memory.

240
00:11:32.360 --> 00:11:35.440
<v Speaker 1>So you're basically doing the computer's job for it, manually

241
00:11:35.480 --> 00:11:40.000
<v Speaker 1>calculating and arranging sixty four distinct electrical charges just to

242
00:11:40.039 --> 00:11:41.639
<v Speaker 1>teach the machine the number thirteen.

243
00:11:42.080 --> 00:11:46.159
<v Speaker 2>It was incredibly tedious, highly error prone work. Today, the

244
00:11:46.240 --> 00:11:50.039
<v Speaker 2>JavaScript language handles all that translation invisibly. You type the

245
00:11:50.120 --> 00:11:53.879
<v Speaker 2>number thirteen on your keyboard and the language instantly automatically

246
00:11:53.919 --> 00:11:56.879
<v Speaker 2>generates the correct sixty four bit pattern and slots it

247
00:11:56.919 --> 00:11:58.039
<v Speaker 2>into the computer's memory.

248
00:11:58.240 --> 00:12:01.320
<v Speaker 1>It feels like magic when it works per But you know,

249
00:12:01.399 --> 00:12:03.600
<v Speaker 1>as we teased at the very beginning of this steep dive,

250
00:12:03.720 --> 00:12:06.960
<v Speaker 1>JavaScript is not a perfectly logical, predictable language.

251
00:12:07.000 --> 00:12:07.679
<v Speaker 2>No it is not.

252
00:12:07.840 --> 00:12:10.799
<v Speaker 1>It has a very specific, somewhat chaotic personality, and that

253
00:12:10.840 --> 00:12:13.919
<v Speaker 1>personality actually comes from its history. It was created in

254
00:12:13.960 --> 00:12:16.159
<v Speaker 1>a massive hurry back in nineteen ninety five for the

255
00:12:16.360 --> 00:12:18.039
<v Speaker 1>Netscape Navigator web browser.

256
00:12:18.159 --> 00:12:21.720
<v Speaker 2>Yeah, and even its name reflects that chaotic birth. The

257
00:12:21.799 --> 00:12:25.039
<v Speaker 2>name JavaScript was purely a marketing ploy. Oh yeah, it

258
00:12:25.080 --> 00:12:29.919
<v Speaker 2>has almost no actual relationship to the highly structured Java

259
00:12:29.960 --> 00:12:33.559
<v Speaker 2>programming language that was incredibly popular at the time. Netscape

260
00:12:33.600 --> 00:12:36.240
<v Speaker 2>just wanted to ride the codetails of Java's hype.

261
00:12:36.039 --> 00:12:40.720
<v Speaker 1>Wow, and that rushed, heavily marketed design process led to

262
00:12:40.799 --> 00:12:45.240
<v Speaker 1>some wild design choices. The source text notes that JavaScript

263
00:12:45.320 --> 00:12:48.440
<v Speaker 1>was intentionally built to be highly forgiving, right. Yes, the

264
00:12:48.519 --> 00:12:51.840
<v Speaker 1>creators wanted it to be accessible for total beginners. The

265
00:12:51.879 --> 00:12:55.120
<v Speaker 1>philosophy was basically that the language should accept almost anything

266
00:12:55.120 --> 00:12:57.639
<v Speaker 1>you type, no matter how badly formatted, without crashing the

267
00:12:57.639 --> 00:12:58.240
<v Speaker 1>web browser.

268
00:12:58.559 --> 00:13:02.039
<v Speaker 2>And I mean, on the surface, a language that refuses

269
00:13:02.039 --> 00:13:05.919
<v Speaker 2>to crash sounds like a beginner's dream, but in practice,

270
00:13:06.000 --> 00:13:08.240
<v Speaker 2>a language that refuses to crash is a language that

271
00:13:08.279 --> 00:13:11.200
<v Speaker 2>refuses to tell you when you've made a catastrophic mistake right.

272
00:13:11.240 --> 00:13:13.480
<v Speaker 1>It hides your errors from you. Instead of stopping the

273
00:13:13.480 --> 00:13:15.919
<v Speaker 1>program and saying, hey, line forty two, it makes no sense,

274
00:13:15.960 --> 00:13:19.440
<v Speaker 1>please fix it, JavaScript decides to just quietly play along.

275
00:13:19.639 --> 00:13:21.639
<v Speaker 2>He uses a process called type coercion.

276
00:13:21.720 --> 00:13:25.000
<v Speaker 3>Type coercion it basically looks at your bad code and

277
00:13:25.080 --> 00:13:28.799
<v Speaker 3>tries to guess your underlying intent. It literally forces one

278
00:13:28.879 --> 00:13:31.200
<v Speaker 3>type of data to become another type of data, so

279
00:13:31.240 --> 00:13:32.679
<v Speaker 3>the equation could just finish.

280
00:13:33.080 --> 00:13:36.320
<v Speaker 1>I love the analogy for this. JavaScript acts exactly like

281
00:13:36.360 --> 00:13:40.279
<v Speaker 1>an overly eager improv comedy partner. Yes, the improv partner,

282
00:13:40.320 --> 00:13:43.679
<v Speaker 1>because the golden rule of improv is yes, and you

283
00:13:43.759 --> 00:13:45.320
<v Speaker 1>never shut down your partner's idea.

284
00:13:45.440 --> 00:13:45.600
<v Speaker 2>Right.

285
00:13:45.679 --> 00:13:48.759
<v Speaker 1>You accept whatever crazy scenario they introduce, and you build

286
00:13:48.840 --> 00:13:50.960
<v Speaker 1>on it. Exactly if you say, hey, I brought a

287
00:13:51.000 --> 00:13:53.600
<v Speaker 1>toaster to the beach, your partner doesn't say that makes

288
00:13:53.600 --> 00:13:56.320
<v Speaker 1>no sense. They say yes, and the toaster is actually

289
00:13:56.360 --> 00:13:57.919
<v Speaker 1>a submarine.

290
00:13:57.279 --> 00:14:00.799
<v Speaker 2>That captures the dynamic perfectly. It keeps the scene moving

291
00:14:00.840 --> 00:14:03.679
<v Speaker 2>forward at all costs, even if you are no longer

292
00:14:03.720 --> 00:14:05.399
<v Speaker 2>in the scene you originally intended to.

293
00:14:05.399 --> 00:14:07.879
<v Speaker 1>Write let's walk through the hilarious examples of this from

294
00:14:07.879 --> 00:14:12.080
<v Speaker 1>the book You Hand JavaScript and equation. Like the number

295
00:14:12.120 --> 00:14:16.919
<v Speaker 1>eight multiplied by null. Now NOLL basically means emptiness nothing.

296
00:14:17.480 --> 00:14:20.600
<v Speaker 1>Instead of crashing, JavaScript says, oh, you want to multiply, Well,

297
00:14:20.639 --> 00:14:22.679
<v Speaker 1>nol is kind of like the number zero yes, and

298
00:14:22.840 --> 00:14:24.240
<v Speaker 1>eight times zero zero zero.

299
00:14:24.720 --> 00:14:28.000
<v Speaker 2>It just quietly converted the concept of emptiness into a

300
00:14:28.039 --> 00:14:29.399
<v Speaker 2>mathematical integer.

301
00:14:29.240 --> 00:14:31.639
<v Speaker 1>And it gets so much weirder. The text points out

302
00:14:31.639 --> 00:14:34.480
<v Speaker 1>that if you take the string five, the actual text

303
00:14:34.600 --> 00:14:36.799
<v Speaker 1>character of a five, and you try to subtract the

304
00:14:36.879 --> 00:14:40.240
<v Speaker 1>number one from it, JavaScript says, well, you obviously can't

305
00:14:40.279 --> 00:14:42.840
<v Speaker 1>subtract numbers from a word, so you must have accidentally

306
00:14:42.840 --> 00:14:45.720
<v Speaker 1>put quotes around the number five. Yes, and five minus

307
00:14:45.759 --> 00:14:46.360
<v Speaker 1>one is four.

308
00:14:46.919 --> 00:14:49.159
<v Speaker 2>It converts the text string into a number type to

309
00:14:49.200 --> 00:14:52.879
<v Speaker 2>make the math work out, which I mean admittedly feels

310
00:14:52.879 --> 00:14:53.879
<v Speaker 2>somewhat intuitive.

311
00:14:54.200 --> 00:14:56.399
<v Speaker 1>But then you try the exact opposite. You take the

312
00:14:56.440 --> 00:14:59.120
<v Speaker 1>string five and you add the number one. A human

313
00:14:59.159 --> 00:15:03.320
<v Speaker 1>would assume the end six naturally, but JavaScript sees the

314
00:15:03.320 --> 00:15:06.240
<v Speaker 1>plus sign and says, oh, a plus sign. You don't

315
00:15:06.240 --> 00:15:08.399
<v Speaker 1>want to do math, you want to glue things together,

316
00:15:08.679 --> 00:15:11.120
<v Speaker 1>So it converts the number one into text, glues it

317
00:15:11.159 --> 00:15:13.879
<v Speaker 1>to the text five, and confidently hands you back the

318
00:15:13.879 --> 00:15:14.919
<v Speaker 1>string fifty one.

319
00:15:15.080 --> 00:15:19.080
<v Speaker 2>It is applying an absolute literal logic to the symbols

320
00:15:19.080 --> 00:15:21.840
<v Speaker 2>you typed, completely blind to the fact that the result

321
00:15:21.919 --> 00:15:24.559
<v Speaker 2>is total nonsense to a human reader. And if you

322
00:15:24.639 --> 00:15:27.799
<v Speaker 2>push it too far, say trying to multiply this spelled

323
00:15:27.799 --> 00:15:31.279
<v Speaker 2>out word five by the number two, it finally realizes

324
00:15:31.360 --> 00:15:34.919
<v Speaker 2>it cannot convert letters into math. So rather than crashing,

325
00:15:35.240 --> 00:15:39.600
<v Speaker 2>it hands you back our old friend nan, not a number.

326
00:15:39.960 --> 00:15:42.879
<v Speaker 1>So, as a programmer trying to build a stable universe,

327
00:15:43.320 --> 00:15:45.919
<v Speaker 1>how do you defend yourself against an improv partner who

328
00:15:45.960 --> 00:15:48.240
<v Speaker 1>constantly alters reality behind your back.

329
00:15:48.480 --> 00:15:50.559
<v Speaker 2>Well, you have to strip away its ability to guess.

330
00:15:50.960 --> 00:15:54.679
<v Speaker 2>You have to be incredibly explicit. The language provides defense

331
00:15:54.720 --> 00:15:57.720
<v Speaker 2>mechanisms for this, thankfully, Like what for example, when you

332
00:15:57.759 --> 00:16:00.000
<v Speaker 2>want to check if two things are equal, you don't

333
00:16:00.120 --> 00:16:02.360
<v Speaker 2>use the standard double equal sign. You use the strictly

334
00:16:02.360 --> 00:16:05.080
<v Speaker 2>equal operator, which is three equal signs in a row.

335
00:16:05.200 --> 00:16:07.039
<v Speaker 1>Oh, so it's like a strict bouncer at the door.

336
00:16:07.120 --> 00:16:10.559
<v Speaker 2>Precisely that triple equal sign tells JavaScript, do not do

337
00:16:10.639 --> 00:16:13.120
<v Speaker 2>any automatic type conversions, do not try to guess what

338
00:16:13.159 --> 00:16:15.799
<v Speaker 2>I meant only return true if these two items are

339
00:16:15.799 --> 00:16:18.039
<v Speaker 2>the exact same type and the exact same value.

340
00:16:18.159 --> 00:16:20.120
<v Speaker 1>So no improbable out none good.

341
00:16:20.320 --> 00:16:24.759
<v Speaker 2>And Another fascinating defense mechanism is exploiting the language's natural

342
00:16:24.840 --> 00:16:27.799
<v Speaker 2>laziness through something called short circuit evaluation.

343
00:16:28.279 --> 00:16:33.120
<v Speaker 1>Short circuit evaluation that sounds incredibly abstract. How do you

344
00:16:33.200 --> 00:16:35.279
<v Speaker 1>exploit laziness in a machine?

345
00:16:35.480 --> 00:16:39.279
<v Speaker 2>Let's translate out of code. Imagine a bouncer at an

346
00:16:39.320 --> 00:16:43.879
<v Speaker 2>exclusive club. Okay, the rule is you can come inside

347
00:16:44.120 --> 00:16:46.320
<v Speaker 2>if you are on the VIP list, or if you

348
00:16:46.360 --> 00:16:49.639
<v Speaker 2>pay one hundred dollars cover charge. You walk up and

349
00:16:49.679 --> 00:16:52.720
<v Speaker 2>the bouncer sees your name on the VIP list. At

350
00:16:52.759 --> 00:16:55.279
<v Speaker 2>that exact moment, does he ask you if you have

351
00:16:55.320 --> 00:16:56.080
<v Speaker 2>one hundred dollars?

352
00:16:56.360 --> 00:16:58.720
<v Speaker 1>No, he doesn't care. The first condition was met, so

353
00:16:58.759 --> 00:17:00.879
<v Speaker 1>he just opens the door or circuits the rest of

354
00:17:00.919 --> 00:17:02.000
<v Speaker 1>the question exactly.

355
00:17:02.159 --> 00:17:05.799
<v Speaker 2>JavaScript handles logical or statements the exact same way. If

356
00:17:05.839 --> 00:17:08.279
<v Speaker 2>you give it an equation that says true r x,

357
00:17:08.680 --> 00:17:11.279
<v Speaker 2>JavaScript seedes that the first part is true, the overall

358
00:17:11.319 --> 00:17:13.759
<v Speaker 2>statement is already satisfied. Oh wow, so it never even

359
00:17:13.799 --> 00:17:16.720
<v Speaker 2>looks at X. It completely ignores whatever code is written there.

360
00:17:17.119 --> 00:17:19.319
<v Speaker 2>X could be a terrible error that would normally crash

361
00:17:19.359 --> 00:17:22.039
<v Speaker 2>the program, but JavaScript is too lazy to read it,

362
00:17:22.160 --> 00:17:23.519
<v Speaker 2>so your program survives.

363
00:17:23.799 --> 00:17:26.839
<v Speaker 1>That is a brilliant way to conceptualize it. So we've

364
00:17:26.839 --> 00:17:29.279
<v Speaker 1>spent all this time talking about values floating in the

365
00:17:29.279 --> 00:17:32.079
<v Speaker 1>sea of bits and how they combine into equations. The

366
00:17:32.119 --> 00:17:36.440
<v Speaker 1>book calls these combinations expressions. But an expression sort of

367
00:17:36.480 --> 00:17:40.680
<v Speaker 1>feels like a sentence fragment. Just calculating five plus five

368
00:17:40.839 --> 00:17:43.759
<v Speaker 1>produces the value ten, but it doesn't actually do anything.

369
00:17:43.880 --> 00:17:47.160
<v Speaker 2>Think of an expression like the computer daydreaming. It thinks

370
00:17:47.160 --> 00:17:50.119
<v Speaker 2>to itself five plus five is ten, but it keeps

371
00:17:50.160 --> 00:17:52.160
<v Speaker 2>that thought entirely in its own head.

372
00:17:52.680 --> 00:17:53.440
<v Speaker 1>Oh okay.

373
00:17:53.599 --> 00:17:56.799
<v Speaker 2>To actually change the state of the machine, we need

374
00:17:56.920 --> 00:18:00.400
<v Speaker 2>what the book calls a statement. A statement is full

375
00:18:00.480 --> 00:18:04.079
<v Speaker 2>complete sentence. It crosses the boundary from digital thought into

376
00:18:04.079 --> 00:18:06.759
<v Speaker 2>physical reality by creating a side effect.

377
00:18:06.960 --> 00:18:09.880
<v Speaker 1>A side effect that's the computer finally opening its mouth

378
00:18:09.920 --> 00:18:12.559
<v Speaker 1>to speak. Basically, it pops a dialogue box up on

379
00:18:12.599 --> 00:18:14.599
<v Speaker 1>your screen, or it reaches out and saves a file

380
00:18:14.640 --> 00:18:16.079
<v Speaker 1>to your hard drive exactly.

381
00:18:16.640 --> 00:18:19.519
<v Speaker 2>But to have meaningful side effects over time, the program

382
00:18:19.559 --> 00:18:22.839
<v Speaker 2>cannot just react in the moment. It needs an internal memory.

383
00:18:22.880 --> 00:18:24.920
<v Speaker 2>It needs to keep track of its own state, and

384
00:18:24.960 --> 00:18:26.640
<v Speaker 2>we achieve this using variables.

385
00:18:27.000 --> 00:18:29.640
<v Speaker 1>And here is a crucial mental shift the author demands

386
00:18:29.680 --> 00:18:32.720
<v Speaker 1>from the reader. Anyone who has gabbled encrding is usually

387
00:18:32.720 --> 00:18:35.039
<v Speaker 1>taught that a variable is like a little cardboard box

388
00:18:35.039 --> 00:18:36.480
<v Speaker 1>where you store a piece of data.

389
00:18:36.559 --> 00:18:38.480
<v Speaker 2>Right, that's the classic teaching tool, right.

390
00:18:38.680 --> 00:18:42.440
<v Speaker 1>But the book consists that variables are absolutely not boxes.

391
00:18:42.640 --> 00:18:43.759
<v Speaker 1>They are tentacles.

392
00:18:44.240 --> 00:18:48.960
<v Speaker 2>It is such a visceral, accurate metaphor. Really, Yeah, variables

393
00:18:48.960 --> 00:18:51.200
<v Speaker 2>do not contain values. They grasp them.

394
00:18:51.279 --> 00:18:52.079
<v Speaker 1>They grasp them.

395
00:18:52.200 --> 00:18:56.920
<v Speaker 2>Yeah. Picture a massive, invisible octopus living inside your computer's memory.

396
00:18:57.799 --> 00:19:00.079
<v Speaker 2>When you define a new variable, you are commanding the

397
00:19:00.079 --> 00:19:02.839
<v Speaker 2>program to grow a new tentacle, reach out into the

398
00:19:02.880 --> 00:19:06.079
<v Speaker 2>sea of bits and hold tightly onto a specific value.

399
00:19:06.200 --> 00:19:08.799
<v Speaker 1>Okay, Let's say I create a variable called Luji's debt

400
00:19:08.880 --> 00:19:11.000
<v Speaker 1>and I tell the program his debt is one hundred

401
00:19:11.000 --> 00:19:14.240
<v Speaker 1>and forty dollars. So tentacle grows and wraps tightly around

402
00:19:14.279 --> 00:19:16.960
<v Speaker 1>the sixty four bit chunk of memory representing the number one.

403
00:19:16.839 --> 00:19:19.400
<v Speaker 2>Forty Yep, it's holding onto it. And the reason the

404
00:19:19.400 --> 00:19:22.079
<v Speaker 2>technical analogy is far superior to the box analogy is

405
00:19:22.079 --> 00:19:24.960
<v Speaker 2>that two separate variables can easily point to the exact

406
00:19:24.960 --> 00:19:27.839
<v Speaker 2>same value. Two tentacles can grab the same number in memory.

407
00:19:27.920 --> 00:19:28.599
<v Speaker 1>Oh that makes sense.

408
00:19:28.640 --> 00:19:31.160
<v Speaker 2>Now imagine Luigi pays you back thirty five dollars. His

409
00:19:31.240 --> 00:19:33.799
<v Speaker 2>debt is now one oh five. If variables were boxes,

410
00:19:33.799 --> 00:19:35.519
<v Speaker 2>you would open the box, throw away the one forty,

411
00:19:35.519 --> 00:19:37.920
<v Speaker 2>and put a one oh five inside. But with tentacles

412
00:19:37.920 --> 00:19:40.480
<v Speaker 2>the action is much more fluid. The tentacle simply lets

413
00:19:40.480 --> 00:19:43.039
<v Speaker 2>go of the one forty, reaches over, and grasps the

414
00:19:43.119 --> 00:19:44.319
<v Speaker 2>number one oh five instead.

415
00:19:44.519 --> 00:19:46.640
<v Speaker 1>Wait, what happens if you tell the program to grow

416
00:19:46.640 --> 00:19:49.000
<v Speaker 1>a tentacle, but you don't actually tell it what to grab.

417
00:19:49.200 --> 00:19:52.039
<v Speaker 2>Then the tentacles just waving around, grasping it thin air.

418
00:19:52.839 --> 00:19:56.240
<v Speaker 2>In JavaScript, we represent that empty grasp with a special

419
00:19:56.319 --> 00:20:00.680
<v Speaker 2>value called undefined. It signifies the purposeful absence of a

420
00:20:00.720 --> 00:20:01.640
<v Speaker 2>meaningful value.

421
00:20:01.720 --> 00:20:05.319
<v Speaker 1>Okay, but a chaotic mess of tentacles blindly grabbing at

422
00:20:05.400 --> 00:20:08.880
<v Speaker 1>numbers doesn't sound like a functioning universe. Something has to

423
00:20:09.039 --> 00:20:12.559
<v Speaker 1>orchestrate all this grasping and letting go, right, How do

424
00:20:12.599 --> 00:20:13.519
<v Speaker 1>we build structure?

425
00:20:13.839 --> 00:20:17.880
<v Speaker 2>We organize the chaos by packaging code into functions. A

426
00:20:17.920 --> 00:20:20.599
<v Speaker 2>function is well, it's a block of instructions that you

427
00:20:20.680 --> 00:20:22.880
<v Speaker 2>wrap up name and save.

428
00:20:22.720 --> 00:20:25.400
<v Speaker 1>For later, like things you want to repeat exactly.

429
00:20:25.000 --> 00:20:27.599
<v Speaker 2>Things like popping up an alert on the screen, and

430
00:20:27.720 --> 00:20:30.839
<v Speaker 2>to orchestrate when these functions run and when these tentacles move,

431
00:20:31.160 --> 00:20:32.319
<v Speaker 2>we use control flow.

432
00:20:32.519 --> 00:20:35.079
<v Speaker 1>Ah, this is how the mental maze is constructed.

433
00:20:35.200 --> 00:20:37.759
<v Speaker 2>Yes, the simplest form of control flow is just a

434
00:20:37.759 --> 00:20:41.079
<v Speaker 2>straight line executing statements from top to bottom. But a

435
00:20:41.119 --> 00:20:44.880
<v Speaker 2>straight line isn't intelligent. We need the program to make decisions,

436
00:20:45.319 --> 00:20:48.319
<v Speaker 2>so we build forks in the road using conditional execution,

437
00:20:48.920 --> 00:20:51.960
<v Speaker 2>like if and L statements. If the user gives us

438
00:20:51.960 --> 00:20:56.000
<v Speaker 2>a password, let them in, else lock the screen.

439
00:20:56.160 --> 00:20:58.799
<v Speaker 1>And if we need the program to monitor something continuously,

440
00:20:58.920 --> 00:20:59.720
<v Speaker 1>we use loops.

441
00:20:59.799 --> 00:21:02.559
<v Speaker 2>Without lukes, a program would just run through its instructions

442
00:21:02.559 --> 00:21:05.720
<v Speaker 2>once and immediately die. A loop gives the program a

443
00:21:05.759 --> 00:21:06.200
<v Speaker 2>heart beat.

444
00:21:06.319 --> 00:21:07.799
<v Speaker 1>I love that a heart beat.

445
00:21:07.920 --> 00:21:10.000
<v Speaker 2>It allows the program to wake up, look at the

446
00:21:10.039 --> 00:21:12.839
<v Speaker 2>current state of its universe, make a change, and then

447
00:21:12.880 --> 00:21:16.200
<v Speaker 2>go back to sleep, over and over again. That repetitive

448
00:21:16.240 --> 00:21:19.119
<v Speaker 2>cycle is the fundamental mechanism that keeps a video game

449
00:21:19.200 --> 00:21:23.400
<v Speaker 2>running continuously on your screen, updating the graphics sixty times

450
00:21:23.400 --> 00:21:25.079
<v Speaker 2>a second based on what you are doing.

451
00:21:25.160 --> 00:21:27.759
<v Speaker 1>Wow, it's all just loops, tentacles, and conditional forks in

452
00:21:27.799 --> 00:21:30.839
<v Speaker 1>the road, which actually leads me back to that profound

453
00:21:30.839 --> 00:21:33.200
<v Speaker 1>idea of side effects. I want to ask a clarifying

454
00:21:33.279 --> 00:21:36.640
<v Speaker 1>question here. Yeah, if a program uses loops to calculate

455
00:21:36.640 --> 00:21:39.000
<v Speaker 1>the secrets of the universe for a million years in

456
00:21:39.039 --> 00:21:42.200
<v Speaker 1>a dark server room, but it never once triggers a

457
00:21:42.240 --> 00:21:44.920
<v Speaker 1>side effect. It never prints the answer to a screen,

458
00:21:45.319 --> 00:21:48.559
<v Speaker 1>never saves it to a drive, never moves a robotic arm.

459
00:21:48.720 --> 00:21:51.799
<v Speaker 1>Did it actually happen? Our side effects the only proof

460
00:21:51.960 --> 00:21:53.920
<v Speaker 1>a digital universe exists.

461
00:21:53.599 --> 00:21:56.680
<v Speaker 2>I mean from our human perspective outside the machine. Yes,

462
00:21:57.480 --> 00:22:01.400
<v Speaker 2>the internal state, all those shifting tentacles, brilliant expressions, they

463
00:22:01.400 --> 00:22:02.920
<v Speaker 2>are entirely invisible to us.

464
00:22:03.000 --> 00:22:04.839
<v Speaker 1>So it's just a computer talking to itself.

465
00:22:04.880 --> 00:22:07.680
<v Speaker 2>Basically, a side effect is the only way a program

466
00:22:07.759 --> 00:22:10.920
<v Speaker 2>reaches out of its digital universe and proves its existence

467
00:22:10.920 --> 00:22:11.839
<v Speaker 2>in the physical world.

468
00:22:12.119 --> 00:22:13.839
<v Speaker 1>That is just wild to think about. Let's bring this

469
00:22:14.000 --> 00:22:17.000
<v Speaker 1>entire deep dive full circle them. We started by exploring

470
00:22:17.039 --> 00:22:21.559
<v Speaker 1>the massive philosophical gap between human communication and unfeeling machines.

471
00:22:21.799 --> 00:22:22.200
<v Speaker 2>We did.

472
00:22:22.559 --> 00:22:25.079
<v Speaker 1>We mapped out the transition from graphical menus to the

473
00:22:25.200 --> 00:22:28.119
<v Speaker 1>raw power of language. We waded through an ocean of

474
00:22:28.160 --> 00:22:32.240
<v Speaker 1>thirty billion bits, navigating sixty four bit containers and approximate fractions.

475
00:22:32.680 --> 00:22:35.400
<v Speaker 1>We learned how to defend ourselves against JavaScript, acting like

476
00:22:35.440 --> 00:22:40.079
<v Speaker 1>a chaotic improv partner the yes and language exactly, and

477
00:22:40.119 --> 00:22:44.960
<v Speaker 1>we envisioned on an octopus of variables, grasping values just

478
00:22:45.039 --> 00:22:46.400
<v Speaker 1>to orchestrate a universe.

479
00:22:46.839 --> 00:22:49.680
<v Speaker 2>And through all of that, you know, the core lesson

480
00:22:49.720 --> 00:22:52.599
<v Speaker 2>from the author really remains the same. The real challenge

481
00:22:52.599 --> 00:22:56.160
<v Speaker 2>isn't memorizing the syntax. The challenge is subduing the chaos.

482
00:22:57.160 --> 00:23:00.960
<v Speaker 2>Programming is this constant, active discipline of keeping your own

483
00:23:01.000 --> 00:23:03.240
<v Speaker 2>mental universe from collapsing under its own weight.

484
00:23:03.480 --> 00:23:06.400
<v Speaker 1>It's designing the maze so perfectly that you always know

485
00:23:06.480 --> 00:23:09.039
<v Speaker 1>your way out. But as we wrap up, I want

486
00:23:09.039 --> 00:23:11.000
<v Speaker 1>to leave you with one final thought. Tam all over.

487
00:23:11.200 --> 00:23:11.680
<v Speaker 2>Let's hear it.

488
00:23:12.240 --> 00:23:14.119
<v Speaker 1>The book makes it clear that a variable is just

489
00:23:14.240 --> 00:23:18.119
<v Speaker 1>a tentacle temporarily grasping of value in a highly volatile

490
00:23:18.160 --> 00:23:20.599
<v Speaker 1>sea of memory. And it notes that when a value

491
00:23:20.680 --> 00:23:23.880
<v Speaker 1>is no longer being grasped by any tentacle, it simply dissipates.

492
00:23:24.160 --> 00:23:26.920
<v Speaker 1>The computer sweeps it away and recycles the space. Right,

493
00:23:27.279 --> 00:23:31.200
<v Speaker 1>So think about this. What happens to that intricate, magnificent universe.

494
00:23:31.240 --> 00:23:34.559
<v Speaker 1>A programmer spent thousands of hours building out of pure thought.

495
00:23:34.880 --> 00:23:37.480
<v Speaker 1>The exact microsecond the power cord is pulled or the

496
00:23:37.519 --> 00:23:40.839
<v Speaker 1>browser tap is closed, does all that complex architecture just

497
00:23:40.960 --> 00:23:43.880
<v Speaker 1>vanish into the digital ether, completely erased, as if it

498
00:23:43.960 --> 00:23:45.000
<v Speaker 1>never existed at all.

499
00:23:45.119 --> 00:23:48.720
<v Speaker 2>Wow, it is an incredibly fragile kind of magic, it

500
00:23:48.759 --> 00:23:49.160
<v Speaker 2>really is.

501
00:23:49.200 --> 00:23:52.319
<v Speaker 1>It makes you appreciate sneaking into that digital kitchen just

502
00:23:52.359 --> 00:23:54.759
<v Speaker 1>a little bit more, doesn't it. Thank you for joining

503
00:23:54.839 --> 00:23:55.960
<v Speaker 1>us on this deep dive
