WEBVTT

1
00:00:00.160 --> 00:00:03.200
<v Speaker 1>Imagine hiring a contractor to build a house for you,

2
00:00:03.960 --> 00:00:06.799
<v Speaker 1>but instead of just handing them a beautiful blueprint and

3
00:00:06.879 --> 00:00:09.279
<v Speaker 1>letting them get to work, you are basically forced to

4
00:00:09.320 --> 00:00:10.519
<v Speaker 1>stand right next.

5
00:00:10.279 --> 00:00:12.119
<v Speaker 2>To them, just watching their every move.

6
00:00:12.279 --> 00:00:14.880
<v Speaker 1>Exactly you're telling them exactly what angle to swing their

7
00:00:14.880 --> 00:00:17.839
<v Speaker 1>hammer for every single nail. You know, you have to

8
00:00:17.960 --> 00:00:20.559
<v Speaker 1>dictate how much force to use, which hand to hold

9
00:00:20.559 --> 00:00:23.719
<v Speaker 1>the nail with, and even like when to take a breath.

10
00:00:23.839 --> 00:00:26.160
<v Speaker 2>It sounds absolutely exhausting, right.

11
00:00:26.280 --> 00:00:28.800
<v Speaker 1>But for a very long time, that is essentially what

12
00:00:28.800 --> 00:00:31.079
<v Speaker 1>writing software was like. You didn't just tell the computer

13
00:00:31.160 --> 00:00:35.600
<v Speaker 1>what you wanted. You had to meticulously choreograph every agonizing

14
00:00:35.640 --> 00:00:38.280
<v Speaker 1>step of how to actually get there.

15
00:00:38.399 --> 00:00:40.920
<v Speaker 2>Yeah, and that is a phenomenal way to frame the

16
00:00:41.000 --> 00:00:45.000
<v Speaker 2>history of programming, because the evolution of a language it

17
00:00:45.039 --> 00:00:48.240
<v Speaker 2>isn't just about adding new buttons to the dashboard. It's

18
00:00:48.280 --> 00:00:53.560
<v Speaker 2>a relentless march towards stripping away that tedious mechanical choreography.

19
00:00:52.960 --> 00:00:54.640
<v Speaker 1>All that extra baggage.

20
00:00:54.240 --> 00:00:57.479
<v Speaker 2>Exactly what we often call the fluff. The goal is

21
00:00:57.520 --> 00:01:00.719
<v Speaker 2>so that the developer's pure intent can actually shine through.

22
00:01:01.039 --> 00:01:03.799
<v Speaker 1>And that brings me to this brilliant analogy I read

23
00:01:03.799 --> 00:01:08.040
<v Speaker 1>recently about pianists, which perfectly sets up our mission today.

24
00:01:08.200 --> 00:01:11.560
<v Speaker 1>It says, there are essentially different kinds of players. You know,

25
00:01:11.599 --> 00:01:13.719
<v Speaker 1>You've got the ones who play just because they're forced too.

26
00:01:13.799 --> 00:01:16.000
<v Speaker 2>Sure, they're reluctant students, right, and.

27
00:01:15.959 --> 00:01:18.519
<v Speaker 1>Then you have the professionals who play beautifully just to

28
00:01:18.560 --> 00:01:23.040
<v Speaker 1>get paid. But then there is this totally different breed

29
00:01:23.120 --> 00:01:26.439
<v Speaker 1>of tinkerer. They aren't satisfied with just hearing the music.

30
00:01:26.519 --> 00:01:28.799
<v Speaker 1>They want to physically take the piano apart.

31
00:01:28.879 --> 00:01:30.560
<v Speaker 2>They want to see the mechanics, Yes.

32
00:01:30.840 --> 00:01:34.000
<v Speaker 1>They want to understand the clever little escapements that lift

33
00:01:34.000 --> 00:01:36.560
<v Speaker 1>the damper felt a fraction of a second before the

34
00:01:36.599 --> 00:01:38.200
<v Speaker 1>hammers actually strike the strings.

35
00:01:38.799 --> 00:01:41.760
<v Speaker 2>That is such a great visual And that metaphor was

36
00:01:41.760 --> 00:01:45.519
<v Speaker 2>actually written by Eric Lippert in the forward to the

37
00:01:45.519 --> 00:01:49.040
<v Speaker 2>incredible resource we are exploring today, which is see Sharp

38
00:01:49.079 --> 00:01:50.359
<v Speaker 2>in Depth by John.

39
00:01:50.200 --> 00:01:53.280
<v Speaker 1>Skeet, a truly legendary book in the programming world.

40
00:01:53.359 --> 00:01:57.560
<v Speaker 2>Oh absolutely, and that pianist analogy captures exactly what we're

41
00:01:57.560 --> 00:01:59.640
<v Speaker 2>about to do. We're not just learning how to play

42
00:01:59.640 --> 00:02:02.799
<v Speaker 2>a few big chords today, We're taking the piano apart.

43
00:02:03.040 --> 00:02:06.000
<v Speaker 1>Welcome to the deep dive. Today we are opening up

44
00:02:06.000 --> 00:02:08.599
<v Speaker 1>the hood on c shark, which is, you know, one

45
00:02:08.639 --> 00:02:12.199
<v Speaker 1>of the most widely used programming languages on Earth. It's everywhere,

46
00:02:12.280 --> 00:02:14.719
<v Speaker 1>it really is. Whether you are listening to this on

47
00:02:14.759 --> 00:02:17.159
<v Speaker 1>a podcast app or browsing a web store or playing

48
00:02:17.159 --> 00:02:20.319
<v Speaker 1>a video game, c sharp is likely running somewhere behind

49
00:02:20.319 --> 00:02:23.599
<v Speaker 1>the scenes. Our mission is to explore how this complex

50
00:02:23.719 --> 00:02:26.599
<v Speaker 1>language evolved over time to become closer and closer to

51
00:02:26.719 --> 00:02:27.360
<v Speaker 1>human thought.

52
00:02:27.599 --> 00:02:30.400
<v Speaker 2>And you listening right now, you really don't need to

53
00:02:30.439 --> 00:02:32.680
<v Speaker 2>be a software engineer to appreciate.

54
00:02:32.159 --> 00:02:35.240
<v Speaker 1>This, not at all. If you have ever been frustrated

55
00:02:35.280 --> 00:02:37.800
<v Speaker 1>by an app freezing on your phone, you're going to

56
00:02:37.840 --> 00:02:41.240
<v Speaker 1>find out exactly why that happens and how modern systems

57
00:02:41.240 --> 00:02:42.240
<v Speaker 1>are built to fix it.

58
00:02:42.439 --> 00:02:45.199
<v Speaker 2>Because to truly understand the digital world you interact with

59
00:02:45.240 --> 00:02:47.479
<v Speaker 2>every single day, you have to look at the tools

60
00:02:47.479 --> 00:02:49.560
<v Speaker 2>you used to build it. A language like c sharp

61
00:02:49.680 --> 00:02:53.199
<v Speaker 2>is it's basically a bridge. It connects the chaotic, messy

62
00:02:53.240 --> 00:02:57.199
<v Speaker 2>reality of human ideas to the rigid, mathematical reality of

63
00:02:57.240 --> 00:02:58.520
<v Speaker 2>a computer's processor.

64
00:02:58.960 --> 00:03:03.159
<v Speaker 1>Okay, the War on Fluff, as we called it earlier.

65
00:03:03.520 --> 00:03:06.120
<v Speaker 1>To appreciate how far things have come, we really need

66
00:03:06.159 --> 00:03:08.039
<v Speaker 1>to go all the way back to c sharp version

67
00:03:08.039 --> 00:03:11.000
<v Speaker 1>one and look at a classic everyday scenario.

68
00:03:11.120 --> 00:03:12.639
<v Speaker 2>Sounds good. Where do we start.

69
00:03:12.879 --> 00:03:16.360
<v Speaker 1>Let's say you are building an e commerce store. You

70
00:03:16.439 --> 00:03:18.759
<v Speaker 1>have a product, say a pair of headphones. It has

71
00:03:18.800 --> 00:03:21.639
<v Speaker 1>a name and it has a price. Now you want

72
00:03:21.680 --> 00:03:23.439
<v Speaker 1>to put a bunch of these into a digital shopping

73
00:03:23.479 --> 00:03:26.240
<v Speaker 1>cart in C sharp one. To create a list of

74
00:03:26.240 --> 00:03:29.000
<v Speaker 1>those products, developers had to use a tool called an

75
00:03:29.080 --> 00:03:29.639
<v Speaker 1>array list.

76
00:03:29.840 --> 00:03:33.840
<v Speaker 2>Ah, yes, the infamous array list. And this is where

77
00:03:33.840 --> 00:03:36.319
<v Speaker 2>the early limitations of the language you can very apparent.

78
00:03:36.520 --> 00:03:38.199
<v Speaker 2>And a rayl liist is what we call a weekly

79
00:03:38.240 --> 00:03:38.960
<v Speaker 2>typed collection.

80
00:03:39.120 --> 00:03:42.240
<v Speaker 1>Weekly typed meaning it's not strict exactly.

81
00:03:41.800 --> 00:03:43.840
<v Speaker 2>To the compiler, which you know, is the engine that

82
00:03:43.879 --> 00:03:46.719
<v Speaker 2>translates your human metable code into the zeros and ones

83
00:03:46.879 --> 00:03:49.400
<v Speaker 2>the machine actually understands. An arrayl list is just a

84
00:03:49.479 --> 00:03:51.560
<v Speaker 2>dumb blind cardboard box.

85
00:03:51.759 --> 00:03:52.520
<v Speaker 1>Blind box.

86
00:03:52.639 --> 00:03:55.560
<v Speaker 2>Yeah, it knows that holmes things, but it has absolutely

87
00:03:55.599 --> 00:03:57.439
<v Speaker 2>no idea what those things actually.

88
00:03:57.120 --> 00:04:00.840
<v Speaker 1>Are, which I mean sounds kind of flexible at first,

89
00:04:00.879 --> 00:04:04.439
<v Speaker 1>but think about the danger there. Because the compiler is blind.

90
00:04:05.080 --> 00:04:07.800
<v Speaker 1>You could be filling your digital shopping cart with product

91
00:04:07.840 --> 00:04:11.319
<v Speaker 1>objects and then a bug in your code accidentally shoves

92
00:04:11.360 --> 00:04:14.159
<v Speaker 1>a random text string like the word banana into that

93
00:04:14.240 --> 00:04:15.520
<v Speaker 1>exact same list.

94
00:04:15.360 --> 00:04:16.839
<v Speaker 2>And the compiler wouldn't blink an.

95
00:04:16.720 --> 00:04:18.399
<v Speaker 1>Eye right, it would just say, sure, put it in

96
00:04:18.399 --> 00:04:18.800
<v Speaker 1>the box.

97
00:04:18.959 --> 00:04:22.079
<v Speaker 2>And that creates a literal ticking time bomb in your

98
00:04:22.120 --> 00:04:25.439
<v Speaker 2>software because there are two main phases in software development.

99
00:04:26.000 --> 00:04:28.720
<v Speaker 2>You have compile time when you're building and checking the

100
00:04:28.759 --> 00:04:31.519
<v Speaker 2>code on your machine, and then run time, when the

101
00:04:31.519 --> 00:04:33.800
<v Speaker 2>code is actually executing out in the wild in the

102
00:04:33.839 --> 00:04:34.639
<v Speaker 2>hands of the user.

103
00:04:34.759 --> 00:04:38.160
<v Speaker 1>So the developer thinks everything is fine exactly if the

104
00:04:38.160 --> 00:04:41.600
<v Speaker 1>compiler doesn't catch that mistake, the program compiles perfectly.

105
00:04:42.560 --> 00:04:45.439
<v Speaker 2>But the moment you, the user try to check out,

106
00:04:45.800 --> 00:04:48.439
<v Speaker 2>the program reaches into that box, pulls out the word

107
00:04:48.519 --> 00:04:51.879
<v Speaker 2>banana instead of a product, realizes it doesn't have a price,

108
00:04:51.920 --> 00:04:53.360
<v Speaker 2>and catastrophically crashes.

109
00:04:53.480 --> 00:04:56.600
<v Speaker 1>The app freezes, the user is furious, and the sale

110
00:04:56.639 --> 00:04:58.920
<v Speaker 1>is lost, all because the box was blind.

111
00:04:58.959 --> 00:05:00.160
<v Speaker 2>It's a terrible user EXPERI.

112
00:05:00.560 --> 00:05:03.600
<v Speaker 1>But then C sharp two comes along and introduces this

113
00:05:03.759 --> 00:05:07.759
<v Speaker 1>massive structural shift called generics. Suddenly you don't just have

114
00:05:07.839 --> 00:05:10.800
<v Speaker 1>a generic cardboard box anymore. You have a list of product.

115
00:05:11.279 --> 00:05:14.240
<v Speaker 1>You are basically slapping a highly specific label on the

116
00:05:14.279 --> 00:05:16.959
<v Speaker 1>outside of the box, explicitly telling it what it is

117
00:05:16.959 --> 00:05:17.680
<v Speaker 1>allowed to hold.

118
00:05:17.959 --> 00:05:21.480
<v Speaker 2>You were giving the compiler back its eyesight. By declaring

119
00:05:21.519 --> 00:05:24.279
<v Speaker 2>a generic list of products. The compiler becomes a very

120
00:05:24.319 --> 00:05:25.160
<v Speaker 2>strict inspector.

121
00:05:25.279 --> 00:05:26.839
<v Speaker 1>It's checking at the door right.

122
00:05:27.240 --> 00:05:29.920
<v Speaker 2>If a developer accidentally tries to insert a text string

123
00:05:29.920 --> 00:05:33.480
<v Speaker 2>into that list, the compiler violently rejects it before the

124
00:05:33.519 --> 00:05:36.439
<v Speaker 2>program is ever allowed to run. It forces the error

125
00:05:36.480 --> 00:05:39.160
<v Speaker 2>to happen on the developer's laptop rather than on your

126
00:05:39.160 --> 00:05:41.000
<v Speaker 2>smartphone while you were trying to buy.

127
00:05:40.839 --> 00:05:44.360
<v Speaker 1>Something, moving the burden of checking from the user back

128
00:05:44.399 --> 00:05:47.160
<v Speaker 1>to the system. I love that, But the removal of

129
00:05:47.199 --> 00:05:49.600
<v Speaker 1>fluff really kicks into high gear with C SHAR three.

130
00:05:49.639 --> 00:05:51.839
<v Speaker 2>Oh absolutely. C SHAR three was a game changer.

131
00:05:52.000 --> 00:05:55.279
<v Speaker 1>Let's stick with our shopping card example. The user wants

132
00:05:55.319 --> 00:05:58.240
<v Speaker 1>to sort those products by name. In the old days,

133
00:05:58.240 --> 00:06:00.839
<v Speaker 1>you couldn't just say, you know, sort by name. You

134
00:06:00.920 --> 00:06:03.519
<v Speaker 1>had to write an entirely separate block of code, a

135
00:06:03.560 --> 00:06:05.839
<v Speaker 1>completely different class called an eye comparer.

136
00:06:06.160 --> 00:06:07.000
<v Speaker 2>And it was painful.

137
00:06:07.279 --> 00:06:10.319
<v Speaker 1>It was It was sometimes dozens of lines long, and

138
00:06:10.360 --> 00:06:13.959
<v Speaker 1>its sole purpose was to explicitly define the mathematical mechanics

139
00:06:14.120 --> 00:06:16.000
<v Speaker 1>of how to compare product A to product B.

140
00:06:16.480 --> 00:06:19.560
<v Speaker 2>It was just exhausting boilerplate. You were totally bogged down

141
00:06:19.560 --> 00:06:23.279
<v Speaker 2>in imperative programming, giving the computer step by step instructions

142
00:06:23.279 --> 00:06:26.120
<v Speaker 2>on how to achieve a result, rather than simply stating

143
00:06:26.120 --> 00:06:27.040
<v Speaker 2>what result you wanted.

144
00:06:27.279 --> 00:06:30.839
<v Speaker 1>Enter C shar III and lambda expressions. We get this

145
00:06:31.160 --> 00:06:34.439
<v Speaker 1>sleek little aerosyntax literally just an equal sign and a

146
00:06:34.480 --> 00:06:38.519
<v Speaker 1>greater than sign, and that massive, clunky block of comparison

147
00:06:38.560 --> 00:06:42.680
<v Speaker 1>code shrinks down into a single, beautiful one liner, just dot.

148
00:06:42.519 --> 00:06:44.680
<v Speaker 2>Order by parop dot do.

149
00:06:45.000 --> 00:06:48.360
<v Speaker 1>Name yes, which brings me back to the contractor analogy.

150
00:06:48.720 --> 00:06:51.240
<v Speaker 1>We finally stopped telling the contractor how to swing the hammer.

151
00:06:51.240 --> 00:06:52.839
<v Speaker 1>We just handed them a picture of the finished house

152
00:06:52.839 --> 00:06:54.040
<v Speaker 1>and said build that.

153
00:06:54.040 --> 00:06:57.839
<v Speaker 2>That transition from imperative to declarative programming is arguably the

154
00:06:57.839 --> 00:07:00.360
<v Speaker 2>most profound shift in the history of C shark, and

155
00:07:00.399 --> 00:07:03.399
<v Speaker 2>the absolute pinnacle of that shift in C sharp III is.

156
00:07:03.519 --> 00:07:07.279
<v Speaker 1>Li INQ, which stands for Language Integrated Query Correct.

157
00:07:07.720 --> 00:07:12.040
<v Speaker 2>LIANQ allows developers to filter and sort data using a clean,

158
00:07:12.240 --> 00:07:15.680
<v Speaker 2>incredibly readable syntax that looks a lot like SQL, which

159
00:07:15.720 --> 00:07:17.360
<v Speaker 2>is a language used for databases.

160
00:07:17.800 --> 00:07:20.600
<v Speaker 1>So instead of writing nested loops like look at every item,

161
00:07:20.639 --> 00:07:22.879
<v Speaker 1>if it matches this condition, put it in a new pile,

162
00:07:22.920 --> 00:07:26.120
<v Speaker 1>then sort that pile. You just write one sentence, select

163
00:07:26.120 --> 00:07:28.600
<v Speaker 1>products where price is under twenty dollars, order.

164
00:07:28.439 --> 00:07:31.879
<v Speaker 2>By name exactly. And the real magic is that lanq

165
00:07:32.319 --> 00:07:35.839
<v Speaker 2>works identically whether you are querying data sitting in your

166
00:07:35.839 --> 00:07:40.120
<v Speaker 2>computer's active memory, a text file, or a massive external database.

167
00:07:40.279 --> 00:07:41.639
<v Speaker 1>It abstracts all that away.

168
00:07:41.759 --> 00:07:44.160
<v Speaker 2>It does you express the pure intent of your question,

169
00:07:44.680 --> 00:07:47.839
<v Speaker 2>and the compiler orchestrates the complex machinery required to fetch

170
00:07:47.879 --> 00:07:48.319
<v Speaker 2>the answer.

171
00:07:48.639 --> 00:07:51.879
<v Speaker 1>Okay, making code elegant in a pristine environment is great,

172
00:07:52.160 --> 00:07:54.560
<v Speaker 1>but anyone who has ever used a computer knows the

173
00:07:54.600 --> 00:07:56.720
<v Speaker 1>real world is incredibly messy.

174
00:07:56.759 --> 00:07:57.560
<v Speaker 2>Oh it's chaotic.

175
00:07:57.920 --> 00:08:02.079
<v Speaker 1>Data is chaotic, it's missing, or it belongs to legacy

176
00:08:02.120 --> 00:08:06.160
<v Speaker 1>systems that stubbornly refuse to speak our modern language. So

177
00:08:06.199 --> 00:08:10.120
<v Speaker 1>how did c sharp adapt to the chaos. Let's take

178
00:08:10.120 --> 00:08:13.600
<v Speaker 1>the problem of missing data back to our e commerce store.

179
00:08:13.759 --> 00:08:16.120
<v Speaker 1>Imagine we have a brand new product that is listed

180
00:08:16.120 --> 00:08:18.959
<v Speaker 1>in the catalog, but the marketing team hasn't finalized the

181
00:08:19.000 --> 00:08:21.680
<v Speaker 1>price yet. We literally do not know the price.

182
00:08:22.319 --> 00:08:26.000
<v Speaker 2>This simple reality caused massive headaches in early versions of

183
00:08:26.040 --> 00:08:29.560
<v Speaker 2>c sharp. A price is typically represented as a decimal.

184
00:08:29.839 --> 00:08:32.000
<v Speaker 2>A decimal is what we call a value type, a

185
00:08:32.039 --> 00:08:34.360
<v Speaker 2>concept we will explore deeply in just a few minutes.

186
00:08:34.840 --> 00:08:37.360
<v Speaker 2>But the crucial limitation of a value type in C

187
00:08:37.519 --> 00:08:40.440
<v Speaker 2>sharp one was that it could not naturally be empty.

188
00:08:40.519 --> 00:08:43.200
<v Speaker 2>It was a solid block of memory that absolutely had

189
00:08:43.240 --> 00:08:45.639
<v Speaker 2>to contain a number by default. If you didn't give

190
00:08:45.639 --> 00:08:47.360
<v Speaker 2>it one, it defaulted to zero.

191
00:08:47.480 --> 00:08:49.279
<v Speaker 1>And if you are a store owner, zero is the

192
00:08:49.279 --> 00:08:50.759
<v Speaker 1>most dangerous possible price.

193
00:08:50.879 --> 00:08:51.679
<v Speaker 2>It's a disaster.

194
00:08:51.960 --> 00:08:54.480
<v Speaker 1>If you default an unknown price to zero, users will

195
00:08:54.480 --> 00:08:56.279
<v Speaker 1>immediately add it to their cart and try to check

196
00:08:56.279 --> 00:08:57.919
<v Speaker 1>out for free. You simply can't allow that.

197
00:08:58.159 --> 00:09:01.320
<v Speaker 2>So developers were forced to end near these terrible hacks.

198
00:09:01.919 --> 00:09:05.279
<v Speaker 2>They would create a boolean flag, literally, a completely separate,

199
00:09:05.559 --> 00:09:09.399
<v Speaker 2>disconnected true or false variable named something like sprice vallat,

200
00:09:09.919 --> 00:09:10.600
<v Speaker 2>just hanging.

201
00:09:10.399 --> 00:09:12.320
<v Speaker 1>Around to tell the program whether or not to trust

202
00:09:12.320 --> 00:09:13.759
<v Speaker 1>the decimal number exactly.

203
00:09:14.360 --> 00:09:16.679
<v Speaker 2>Or worse, they would use a magic number. They'd set

204
00:09:16.679 --> 00:09:19.840
<v Speaker 2>the price to negative one million, trusting that no real

205
00:09:19.879 --> 00:09:23.320
<v Speaker 2>product would ever cost that, just to represent the unknown state.

206
00:09:23.679 --> 00:09:26.720
<v Speaker 1>Imagine trying to maintain a database where half the columns

207
00:09:26.759 --> 00:09:30.080
<v Speaker 1>are just secondary flags, trying to explain if the primary

208
00:09:30.080 --> 00:09:33.879
<v Speaker 1>columns are actually real. It's a nightmare. But then C

209
00:09:34.120 --> 00:09:37.840
<v Speaker 1>sharp two brings in nullible types, and the syntax is

210
00:09:37.919 --> 00:09:39.480
<v Speaker 1>almost shockingly simple.

211
00:09:39.759 --> 00:09:41.679
<v Speaker 2>What's fascinating here is that they solved it with a

212
00:09:41.720 --> 00:09:44.120
<v Speaker 2>single character. You just add a question mark to the

213
00:09:44.159 --> 00:09:46.679
<v Speaker 2>type declaration. So decimal question mark price.

214
00:09:46.720 --> 00:09:48.799
<v Speaker 1>That's a question mark, and it changes everything.

215
00:09:48.919 --> 00:09:52.000
<v Speaker 2>It entirely changes the semantic meaning of the concept of null.

216
00:09:52.600 --> 00:09:55.600
<v Speaker 2>Previously null just meant a missing reference, a dead end.

217
00:09:56.080 --> 00:10:00.000
<v Speaker 2>With nullible types, null explicitly models the absence of days.

218
00:10:00.399 --> 00:10:01.679
<v Speaker 1>It's a legitimate state now.

219
00:10:01.960 --> 00:10:05.600
<v Speaker 2>Yes, it allows the language to gracefully handle the messy

220
00:10:05.639 --> 00:10:10.000
<v Speaker 2>reality that sometimes I don't know is the only accurate answer.

221
00:10:10.200 --> 00:10:14.759
<v Speaker 1>It models reality beautifully. But speaking of reality, sometimes your

222
00:10:14.879 --> 00:10:18.120
<v Speaker 1>modern elegant C sharp code has to talk to the

223
00:10:18.159 --> 00:10:19.879
<v Speaker 1>ghosts of Microsoft past.

224
00:10:20.120 --> 00:10:22.639
<v Speaker 2>Ah. Yes, legacy systems.

225
00:10:22.679 --> 00:10:26.799
<v Speaker 1>I'm talking about legacy comm technologies, the old underlying machinery

226
00:10:26.960 --> 00:10:30.919
<v Speaker 1>used to automate things like Microsoft Excel or Word. In

227
00:10:30.960 --> 00:10:33.759
<v Speaker 1>the old days, talking to those systems was brutal because

228
00:10:33.799 --> 00:10:37.480
<v Speaker 1>their method signatures, you know, the strict contract of inputs

229
00:10:37.480 --> 00:10:41.600
<v Speaker 1>a piece of code. Demands would sometimes require fifteen different variables.

230
00:10:41.679 --> 00:10:43.799
<v Speaker 2>Even if you only wanted to open a file and

231
00:10:43.879 --> 00:10:46.519
<v Speaker 2>you only cared about the file name, the legacy system

232
00:10:46.559 --> 00:10:49.200
<v Speaker 2>still forced you to pass in fourteen other dummy values

233
00:10:49.480 --> 00:10:50.799
<v Speaker 2>just to satisfy the contract.

234
00:10:50.879 --> 00:10:54.720
<v Speaker 1>But C sharfour introduces named arguments and optional parameters. You

235
00:10:54.840 --> 00:10:57.240
<v Speaker 1>just name the one piece of data you actually care about,

236
00:10:57.279 --> 00:11:00.000
<v Speaker 1>pass it in, and the compiler quietly fills in all

237
00:11:00.039 --> 00:11:03.159
<v Speaker 1>all the other blank spaces with default values behind the scenes.

238
00:11:03.200 --> 00:11:05.799
<v Speaker 2>It's a huge quality of life improvement, it really is.

239
00:11:06.440 --> 00:11:08.440
<v Speaker 1>But wait, I want to pause and push back on

240
00:11:08.480 --> 00:11:11.240
<v Speaker 1>something from C sharfour because it sounds like a massive

241
00:11:11.240 --> 00:11:13.519
<v Speaker 1>contradiction to everything we've established so far.

242
00:11:13.720 --> 00:11:14.159
<v Speaker 2>Let's hear it.

243
00:11:14.600 --> 00:11:17.320
<v Speaker 1>We spent the first half of this deep dive praising

244
00:11:17.360 --> 00:11:20.919
<v Speaker 1>the compiler for being a strict inspector. C sharp is

245
00:11:20.960 --> 00:11:24.279
<v Speaker 1>famously a statically typed language. The compiler wants to know

246
00:11:24.360 --> 00:11:27.279
<v Speaker 1>exactly what every variable is before the code is ever

247
00:11:27.360 --> 00:11:29.559
<v Speaker 1>allowed to run, which is what keeps us safe. Sure,

248
00:11:29.759 --> 00:11:33.639
<v Speaker 1>but C scharfur introduced the dynamic keyword. It lets you

249
00:11:33.679 --> 00:11:36.440
<v Speaker 1>write code where the right piler basically turns off, shrugs

250
00:11:36.480 --> 00:11:38.720
<v Speaker 1>its shoulders, and says, I have no idea what this is,

251
00:11:38.759 --> 00:11:42.639
<v Speaker 1>I'll figure it out later. Isn't that breaking the fundamental

252
00:11:42.720 --> 00:11:44.039
<v Speaker 1>sacred rule of the language.

253
00:11:44.080 --> 00:11:47.080
<v Speaker 2>It looks exactly like a contradiction on the surface, but

254
00:11:47.159 --> 00:11:51.000
<v Speaker 2>it is actually a profound demonstration of pragmatic design. C

255
00:11:51.200 --> 00:11:55.840
<v Speaker 2>sharp remains overwhelmingly statically typed, but there are specific, isolated

256
00:11:55.879 --> 00:11:59.480
<v Speaker 2>scenarios where you absolutely must talk to environments that don't

257
00:11:59.480 --> 00:12:02.759
<v Speaker 2>play by those rules, like Python scripts or very flexible

258
00:12:02.759 --> 00:12:03.799
<v Speaker 2>web services.

259
00:12:03.480 --> 00:12:06.279
<v Speaker 1>Because Python is a dynamic language where variables can change

260
00:12:06.279 --> 00:12:07.159
<v Speaker 1>their pipe on the fly.

261
00:12:07.480 --> 00:12:11.679
<v Speaker 2>Correct If c shark rigidly refuse to bend its rules,

262
00:12:12.200 --> 00:12:15.200
<v Speaker 2>developers trying to bridge those two worlds would be forced

263
00:12:15.200 --> 00:12:18.480
<v Speaker 2>to use something called reflection, and reflection is bad well.

264
00:12:18.519 --> 00:12:21.679
<v Speaker 2>Reflection is a highly complex process where a program has

265
00:12:21.679 --> 00:12:24.440
<v Speaker 2>to blindly examine itself or another program while it's running

266
00:12:24.639 --> 00:12:27.519
<v Speaker 2>without a map. It's like trying to navigate a dark

267
00:12:27.600 --> 00:12:30.519
<v Speaker 2>room by just walking forward until you bump into the furniture.

268
00:12:31.120 --> 00:12:34.919
<v Speaker 2>It is slow for both and incredibly error prone.

269
00:12:35.000 --> 00:12:38.000
<v Speaker 1>So the dynamic keyword is like handing the developer a

270
00:12:38.080 --> 00:12:40.159
<v Speaker 1>specialized flashlight for that dark room.

271
00:12:40.360 --> 00:12:44.519
<v Speaker 2>Yes, exactly. By introducing dynamic sea sharp lets you selectively

272
00:12:44.559 --> 00:12:47.919
<v Speaker 2>bypass the compiler strict checks, but only when you explicitly

273
00:12:47.919 --> 00:12:51.320
<v Speaker 2>declare that you need to. It sacrifices a tiny sliver

274
00:12:51.360 --> 00:12:54.279
<v Speaker 2>of theoretical purity to give the developer a massive amount

275
00:12:54.320 --> 00:12:55.440
<v Speaker 2>of practical capability.

276
00:12:55.519 --> 00:12:57.320
<v Speaker 1>I will let you break the rules, but you have

277
00:12:57.360 --> 00:12:58.480
<v Speaker 1>to sign a waiver first.

278
00:12:58.639 --> 00:12:59.519
<v Speaker 2>That's a great way to put it.

279
00:12:59.559 --> 00:13:03.519
<v Speaker 1>That makes makes sense. Okay, we've tackled data and legacy systems,

280
00:13:03.840 --> 00:13:05.919
<v Speaker 1>but if we look at modern applications, the ones you

281
00:13:05.960 --> 00:13:08.279
<v Speaker 1>and I use every day on our phones and laptops,

282
00:13:08.759 --> 00:13:13.440
<v Speaker 1>the biggest bottleneck isn't usually calculating data. It's waiting for it.

283
00:13:13.720 --> 00:13:19.320
<v Speaker 2>Oh. Absolutely, network latency, downloading images, querying a database sitting

284
00:13:19.360 --> 00:13:21.200
<v Speaker 2>on a server halfway across the world.

285
00:13:21.399 --> 00:13:24.480
<v Speaker 1>Right, think about your own experience listening to this. If

286
00:13:24.559 --> 00:13:28.200
<v Speaker 1>your podcast app needs to download the next episode and

287
00:13:28.279 --> 00:13:32.360
<v Speaker 1>the entire screen completely freezes and becomes unresponsive while it

288
00:13:32.440 --> 00:13:35.279
<v Speaker 1>waits for that file, that is a terrible user experience.

289
00:13:35.519 --> 00:13:36.519
<v Speaker 1>You probably delete the.

290
00:13:36.519 --> 00:13:37.480
<v Speaker 2>App without a doubt.

291
00:13:37.679 --> 00:13:40.759
<v Speaker 1>And solving that freezing problem brings us to the absolute

292
00:13:41.000 --> 00:13:44.320
<v Speaker 1>crown jewel of CSHAR five async and a weight.

293
00:13:44.759 --> 00:13:47.559
<v Speaker 2>To really appreciate the elegance of asinc and a weight,

294
00:13:47.639 --> 00:13:52.039
<v Speaker 2>you must understand the historical trauma of asynchronous programming before

295
00:13:52.120 --> 00:13:55.399
<v Speaker 2>CSHAR five. To prevent that screen from freezing, you had

296
00:13:55.440 --> 00:13:57.480
<v Speaker 2>to take the downloading task and push it onto a

297
00:13:57.519 --> 00:14:00.759
<v Speaker 2>background thread, a completely separate track of act execution. Makes

298
00:14:00.799 --> 00:14:03.559
<v Speaker 2>sense so far, but there's an ironclad golden rule in

299
00:14:03.639 --> 00:14:07.639
<v Speaker 2>software development. A background thread is never ever allowed to

300
00:14:07.679 --> 00:14:09.360
<v Speaker 2>directly update the user interface.

301
00:14:09.480 --> 00:14:12.320
<v Speaker 1>Wait really, so if the background thread finishes the download

302
00:14:12.360 --> 00:14:14.519
<v Speaker 1>and tries to directly update the text on a button

303
00:14:14.559 --> 00:14:16.399
<v Speaker 1>to say complete, what happens?

304
00:14:16.440 --> 00:14:19.600
<v Speaker 2>The entire application crashes violently. Oh wow, yeah, because the

305
00:14:19.639 --> 00:14:23.080
<v Speaker 2>main UI thread aggressively protects its domain. So to get

306
00:14:23.120 --> 00:14:26.159
<v Speaker 2>around this, developers wrote what is universally known as.

307
00:14:26.120 --> 00:14:28.000
<v Speaker 1>Spaghetti code, Everyone's favorite.

308
00:14:28.080 --> 00:14:30.639
<v Speaker 2>You start the download on track A, then you write

309
00:14:30.639 --> 00:14:34.120
<v Speaker 2>a complex callback function that just sits and waits. When

310
00:14:34.120 --> 00:14:37.960
<v Speaker 2>the data arrives, that callback has to carefully package the

311
00:14:38.039 --> 00:14:41.480
<v Speaker 2>data up and marshal it back across the boundary to

312
00:14:41.559 --> 00:14:42.840
<v Speaker 2>the main UI thread.

313
00:14:43.039 --> 00:14:45.399
<v Speaker 1>It's like reading a Choose your Own Adventure book where

314
00:14:45.480 --> 00:14:48.480
<v Speaker 1>every single page forces you to jump to three different

315
00:14:48.559 --> 00:14:51.159
<v Speaker 1>chapters just to finish one cohesive sentence.

316
00:14:51.200 --> 00:14:52.720
<v Speaker 2>That's exactly how it felt.

317
00:14:52.559 --> 00:14:56.720
<v Speaker 1>Your Logit is completely fractured. Standard error handling like trcatch

318
00:14:56.759 --> 00:15:00.440
<v Speaker 1>blocks completely breaks down because the code is constantly jumping

319
00:15:00.480 --> 00:15:02.200
<v Speaker 1>across different execution tracks.

320
00:15:02.320 --> 00:15:03.440
<v Speaker 2>It was a mess. Todybug.

321
00:15:03.679 --> 00:15:06.720
<v Speaker 1>Here's where it gets really interesting. With asinc and a weight,

322
00:15:07.080 --> 00:15:09.360
<v Speaker 1>you write your code exactly like you used to in

323
00:15:09.399 --> 00:15:11.759
<v Speaker 1>the simple days. It reads top to bottom, line one,

324
00:15:11.840 --> 00:15:16.320
<v Speaker 1>line two, line three. Your error handling wraps around it perfectly.

325
00:15:16.559 --> 00:15:18.320
<v Speaker 2>It reads synchronously, right.

326
00:15:18.960 --> 00:15:21.399
<v Speaker 1>But I have to ask, how if I type the

327
00:15:21.399 --> 00:15:24.320
<v Speaker 1>word a weight before a download, is the compiler just

328
00:15:24.399 --> 00:15:27.440
<v Speaker 1>quietly spinning up a bunch of new background threads behind

329
00:15:27.440 --> 00:15:29.840
<v Speaker 1>the scenes to hide the messy choose your own adventure

330
00:15:29.879 --> 00:15:30.519
<v Speaker 1>logic from me.

331
00:15:31.200 --> 00:15:34.720
<v Speaker 2>That is the most common and persistent misconception, and it

332
00:15:34.759 --> 00:15:37.120
<v Speaker 2>is vital we clear it up. Hmmm, No, it is

333
00:15:37.159 --> 00:15:39.360
<v Speaker 2>not necessarily spinning up new threads at all.

334
00:15:39.480 --> 00:15:41.639
<v Speaker 1>It's not. Then how does the screen not.

335
00:15:41.720 --> 00:15:45.559
<v Speaker 2>Freeze through an awe inspiring compiler transformation known as the

336
00:15:45.600 --> 00:15:49.159
<v Speaker 2>state machine. When you use the awight keyword, you are

337
00:15:49.159 --> 00:15:53.480
<v Speaker 2>telling the compiler to pause the execution of that specific method.

338
00:15:53.639 --> 00:15:56.679
<v Speaker 2>The compiler takes your method, chops it up, and completely

339
00:15:56.679 --> 00:15:57.960
<v Speaker 2>rewrites it behind the scenes.

340
00:15:58.279 --> 00:15:59.559
<v Speaker 1>What does that actually look like?

341
00:15:59.639 --> 00:16:02.159
<v Speaker 2>In PRAC Think of it like reading a thick novel

342
00:16:02.240 --> 00:16:04.440
<v Speaker 2>and suddenly you need to go cook dinner. You don't

343
00:16:04.480 --> 00:16:06.519
<v Speaker 2>just stare at the page until dinner is done. You

344
00:16:06.559 --> 00:16:09.120
<v Speaker 2>take a sticky note, write down exactly what page you're on,

345
00:16:09.200 --> 00:16:11.399
<v Speaker 2>what line you were reading, and what the characters were

346
00:16:11.440 --> 00:16:11.799
<v Speaker 2>just doing.

347
00:16:12.080 --> 00:16:13.000
<v Speaker 1>You mark your place.

348
00:16:13.360 --> 00:16:16.279
<v Speaker 2>Yes, you place a sticky note in the book, close

349
00:16:16.320 --> 00:16:17.879
<v Speaker 2>it and walk away to do something else.

350
00:16:17.960 --> 00:16:19.799
<v Speaker 1>You yield your attention exactly.

351
00:16:20.240 --> 00:16:23.679
<v Speaker 2>The awake keyword leaves a digital sticky note. It captures

352
00:16:23.679 --> 00:16:26.080
<v Speaker 2>the exact state of all your local variables and the

353
00:16:26.080 --> 00:16:32.159
<v Speaker 2>synchronization context. Then it gracefully exits the method, instantly returning

354
00:16:32.200 --> 00:16:33.679
<v Speaker 2>control to the main UI thread.

355
00:16:33.879 --> 00:16:35.360
<v Speaker 1>So the UI thread is free again.

356
00:16:35.519 --> 00:16:38.279
<v Speaker 2>Right. That thread is now entirely free to handle the

357
00:16:38.360 --> 00:16:40.399
<v Speaker 2>users scrolling, clicking, and interacting.

358
00:16:40.840 --> 00:16:44.080
<v Speaker 1>The screen never freezes, but the DOWNLA is still happening

359
00:16:44.080 --> 00:16:44.720
<v Speaker 1>somewhere right.

360
00:16:44.840 --> 00:16:48.159
<v Speaker 2>Yes, usually hand it off to the operating system's network drivers.

361
00:16:48.600 --> 00:16:50.799
<v Speaker 2>And when those drivers tap the program on the shoulder

362
00:16:50.840 --> 00:16:54.080
<v Speaker 2>and say, hey, the date is here, the state machine

363
00:16:54.120 --> 00:16:56.519
<v Speaker 2>looks at its sticky note, jumps right back to the

364
00:16:56.559 --> 00:16:59.000
<v Speaker 2>exact line of code it left off at, restores all

365
00:16:59.039 --> 00:17:01.279
<v Speaker 2>the variables, and continues reading the book as if it

366
00:17:01.320 --> 00:17:01.840
<v Speaker 2>never left.

367
00:17:02.200 --> 00:17:05.200
<v Speaker 1>That is mind blowing. The compiler absorbs all the complexity

368
00:17:05.240 --> 00:17:07.599
<v Speaker 1>of the state machine. So my intent wait for this

369
00:17:07.680 --> 00:17:10.400
<v Speaker 1>to finish, then do the next thing reads as cleanly

370
00:17:10.440 --> 00:17:11.160
<v Speaker 1>as English.

371
00:17:11.200 --> 00:17:12.440
<v Speaker 2>It's beautiful engineering.

372
00:17:12.599 --> 00:17:15.240
<v Speaker 1>Okay, but we need to pivot because we've been talking

373
00:17:15.279 --> 00:17:18.799
<v Speaker 1>about all this magic state machines leaving sticky notes, L

374
00:17:19.000 --> 00:17:23.200
<v Speaker 1>and Q, querying databases, lambda's sorting lists. None of this

375
00:17:23.279 --> 00:17:26.680
<v Speaker 1>floats in a vacuum. How does the language actually package

376
00:17:26.720 --> 00:17:28.920
<v Speaker 1>up that sticky note to execute it later.

377
00:17:29.039 --> 00:17:31.039
<v Speaker 2>We have to look at the foundations right.

378
00:17:31.160 --> 00:17:33.519
<v Speaker 1>To truly appreciate the magic. We have to look at

379
00:17:33.519 --> 00:17:35.599
<v Speaker 1>the engine that has been hiding in the car since

380
00:17:35.680 --> 00:17:40.440
<v Speaker 1>day one, the core machinery, delegates and the type system, and.

381
00:17:40.400 --> 00:17:43.519
<v Speaker 2>Those two concepts are at the absolute bedrock upon which

382
00:17:43.559 --> 00:17:44.920
<v Speaker 2>all the modern features are built.

383
00:17:45.079 --> 00:17:48.000
<v Speaker 1>Let's start with delegates. Think about how a last will

384
00:17:48.039 --> 00:17:51.000
<v Speaker 1>and testament works in the real world. You are sitting

385
00:17:51.039 --> 00:17:55.319
<v Speaker 1>in an office today writing down specific instructions sell this asset,

386
00:17:55.519 --> 00:17:58.720
<v Speaker 1>donate this money to charity. But those instructions don't.

387
00:17:58.519 --> 00:18:00.559
<v Speaker 2>Happen right now, right they happen in the future.

388
00:18:00.640 --> 00:18:03.200
<v Speaker 1>You are packaging them up, handing them to an attorney,

389
00:18:03.240 --> 00:18:07.200
<v Speaker 1>and saying, execute these instructions later under specific conditions.

390
00:18:07.400 --> 00:18:10.000
<v Speaker 2>A delegate and see start operates exactly like that will.

391
00:18:10.279 --> 00:18:13.279
<v Speaker 2>It is a secure container for an action you are

392
00:18:13.359 --> 00:18:16.519
<v Speaker 2>encapsulating a method, a set of instructions, and handing it

393
00:18:16.559 --> 00:18:18.759
<v Speaker 2>off to another part of your application.

394
00:18:18.480 --> 00:18:19.759
<v Speaker 1>So it's portable logic.

395
00:18:19.960 --> 00:18:23.880
<v Speaker 2>Exactly, you are saying, when the user clicks this button

396
00:18:24.079 --> 00:18:28.279
<v Speaker 2>or when the network download finishes, execute this delegate. It

397
00:18:28.359 --> 00:18:32.440
<v Speaker 2>is the exact mechanism that powers the acing state machines

398
00:18:32.480 --> 00:18:33.319
<v Speaker 2>we just discussed.

399
00:18:33.559 --> 00:18:36.519
<v Speaker 1>And a delegate doesn't just hold one instruction. It holds

400
00:18:36.519 --> 00:18:40.359
<v Speaker 1>an invitation list. You can stack multiple actions inside it,

401
00:18:40.599 --> 00:18:42.839
<v Speaker 1>and when the trigger happens, it runs down the list

402
00:18:42.920 --> 00:18:44.960
<v Speaker 1>and executes every single one in order.

403
00:18:45.039 --> 00:18:46.039
<v Speaker 2>It's very powerful.

404
00:18:46.440 --> 00:18:49.160
<v Speaker 1>But listeners might have heard the term events used in

405
00:18:49.200 --> 00:18:51.519
<v Speaker 1>the same breath. They aren't the same thing, are they.

406
00:18:51.640 --> 00:18:55.920
<v Speaker 2>They are deeply related, but distinct. If a delegate is

407
00:18:55.960 --> 00:18:58.839
<v Speaker 2>the raw list of instructions, an event is just a

408
00:18:58.839 --> 00:19:02.000
<v Speaker 2>protective shell wrapped around it. A shell think of a

409
00:19:02.000 --> 00:19:04.240
<v Speaker 2>fire alarm switch. You want people to be able to

410
00:19:04.279 --> 00:19:05.599
<v Speaker 2>pull it, but you don't want them to be able

411
00:19:05.640 --> 00:19:07.960
<v Speaker 2>to rip the wiring out of the wall. An event

412
00:19:08.000 --> 00:19:11.839
<v Speaker 2>provides ad and remove access. It ensures that outside code

413
00:19:11.880 --> 00:19:15.480
<v Speaker 2>can subscribe to the alert, but cannot maliciously overwrite or

414
00:19:15.519 --> 00:19:18.359
<v Speaker 2>prematurely trigger the entire list of delegates.

415
00:19:18.519 --> 00:19:21.559
<v Speaker 1>A protective glass box over the wiring. I like that. Okay,

416
00:19:21.640 --> 00:19:24.359
<v Speaker 1>let's look at the other foundational pillar, the type system.

417
00:19:24.440 --> 00:19:25.279
<v Speaker 2>This is a big one.

418
00:19:25.319 --> 00:19:28.279
<v Speaker 1>We've established that C sharp is incredibly strict and safe,

419
00:19:28.839 --> 00:19:32.319
<v Speaker 1>but the biggest conceptual hurdle for anyone learning how computers

420
00:19:32.359 --> 00:19:37.319
<v Speaker 1>manage memory is understanding value types versus reference types. And

421
00:19:37.400 --> 00:19:39.559
<v Speaker 1>I want to use a real world of visual for this.

422
00:19:39.680 --> 00:19:42.160
<v Speaker 1>O court Imagine I have a printed recipe. I want

423
00:19:42.200 --> 00:19:44.799
<v Speaker 1>you to have it, So I go to a physical copier,

424
00:19:45.039 --> 00:19:47.440
<v Speaker 1>make a duplicate piece of paper and hand it to you.

425
00:19:47.960 --> 00:19:49.839
<v Speaker 1>If you take a red marker and cross out the

426
00:19:49.880 --> 00:19:53.640
<v Speaker 1>salt on your copy, my original recipe is completely unchanged.

427
00:19:54.039 --> 00:19:56.559
<v Speaker 1>We have two independent realities.

428
00:19:56.119 --> 00:19:59.119
<v Speaker 2>And that is precisely how a value type behaves in memory.

429
00:19:59.519 --> 00:20:02.519
<v Speaker 2>Things like that simple integers or decimal numbers or struts.

430
00:20:03.000 --> 00:20:05.400
<v Speaker 2>When you pass a value type from one function to another,

431
00:20:05.720 --> 00:20:08.599
<v Speaker 2>the computer physically copies the data, so it's safe to modifyer.

432
00:20:08.960 --> 00:20:11.480
<v Speaker 2>It is highly efficient. But they are entirely independent.

433
00:20:11.640 --> 00:20:14.119
<v Speaker 1>But a reference type is completely different. A reference type

434
00:20:14.160 --> 00:20:17.160
<v Speaker 1>is like me giving you the URL to a Google doc.

435
00:20:17.559 --> 00:20:20.319
<v Speaker 1>We both possess the exact same link. If you open

436
00:20:20.359 --> 00:20:22.839
<v Speaker 1>that URL, log in and delete a paragraph. When I

437
00:20:22.880 --> 00:20:25.519
<v Speaker 1>open my URL, that paragraph is gone for me too.

438
00:20:25.839 --> 00:20:28.160
<v Speaker 1>We are pointing to the exact same location in the.

439
00:20:28.079 --> 00:20:30.359
<v Speaker 2>Cloud, which can be risky if you aren't careful.

440
00:20:30.599 --> 00:20:34.200
<v Speaker 1>In c sharp, things like classes, arrays, and delegates are

441
00:20:34.240 --> 00:20:37.200
<v Speaker 1>reference types. We are just passing around the URL the

442
00:20:37.240 --> 00:20:39.079
<v Speaker 1>memory address and internalizing.

443
00:20:39.119 --> 00:20:42.359
<v Speaker 2>This distinction isn't just about writing efficient code. It connects

444
00:20:42.400 --> 00:20:44.480
<v Speaker 2>directly to the profound safety the.

445
00:20:44.440 --> 00:20:47.599
<v Speaker 1>C sharp ecosystem explain the safety aspect. Why does the

446
00:20:47.599 --> 00:20:49.720
<v Speaker 1>compiler care so much about these addresses?

447
00:20:50.279 --> 00:20:53.440
<v Speaker 2>Because if we look at older unsafe languages like C

448
00:20:53.759 --> 00:20:56.880
<v Speaker 2>or C plus plus D, the compiler trust the developer

449
00:20:56.920 --> 00:20:59.480
<v Speaker 2>to a fault. In C plus plus FEE, you can

450
00:20:59.480 --> 00:21:02.640
<v Speaker 2>take a point a memory address holding a URL to

451
00:21:02.680 --> 00:21:05.720
<v Speaker 2>a text string, and you can forcefully command the compiler

452
00:21:05.759 --> 00:21:09.000
<v Speaker 2>to interpret the raw bites at that address as if

453
00:21:09.039 --> 00:21:10.359
<v Speaker 2>they were a simple integer.

454
00:21:10.200 --> 00:21:12.039
<v Speaker 1>Which makes no sense. It's like trying to play a

455
00:21:12.119 --> 00:21:13.440
<v Speaker 1>VHS tape in a toaster.

456
00:21:13.720 --> 00:21:18.440
<v Speaker 2>Precisely, you are fundamentally misinterpreting the physical memory. When that happens,

457
00:21:18.559 --> 00:21:23.359
<v Speaker 2>the program doesn't cleanly stop. It silently corrupts data, crashes unpredictably,

458
00:21:23.759 --> 00:21:27.319
<v Speaker 2>or opens up massive security vulnerabilities that hackers exploit, but.

459
00:21:27.319 --> 00:21:30.039
<v Speaker 1>C sharp's type system acts as a massive safety net.

460
00:21:30.319 --> 00:21:32.480
<v Speaker 1>It knows exactly what is a value and what is

461
00:21:32.519 --> 00:21:33.039
<v Speaker 1>a reference.

462
00:21:33.200 --> 00:21:34.680
<v Speaker 2>It won't let you put the vhs in.

463
00:21:34.640 --> 00:21:37.319
<v Speaker 1>The toaster right If you try to blindly force a

464
00:21:37.359 --> 00:21:40.160
<v Speaker 1>text string into an integer box, it stops you at

465
00:21:40.160 --> 00:21:43.640
<v Speaker 1>compile time. Or if you are doing something complex dynamically

466
00:21:43.640 --> 00:21:46.680
<v Speaker 1>and it fails at runtime, it safely throws a cleanly

467
00:21:46.720 --> 00:21:50.680
<v Speaker 1>formatted exception and stops the operation. Rather than corrupting your memory.

468
00:21:50.880 --> 00:21:53.480
<v Speaker 2>It guarantees that your data is exactly what the system

469
00:21:53.519 --> 00:21:54.039
<v Speaker 2>thinks it is.

470
00:21:54.240 --> 00:21:55.920
<v Speaker 1>Okay, let's take a breath and look back at the

471
00:21:56.000 --> 00:21:59.720
<v Speaker 1>journey we've just taken. We started in the verbose, heavily

472
00:21:59.759 --> 00:22:02.920
<v Speaker 1>core geograph days of c sharp one, where every tiny

473
00:22:02.960 --> 00:22:07.200
<v Speaker 1>action required massive amounts of boilerplate code and blind cardboard boxes.

474
00:22:07.240 --> 00:22:08.440
<v Speaker 2>It was a lot of manual labor.

475
00:22:08.640 --> 00:22:11.039
<v Speaker 1>Then we moved through the data revolution of LA and

476
00:22:11.160 --> 00:22:14.200
<v Speaker 1>Q and c sharp three, where we finally started declaring

477
00:22:14.200 --> 00:22:17.319
<v Speaker 1>our pure intent instead of tedious instructions. We saw the

478
00:22:17.400 --> 00:22:21.480
<v Speaker 1>dynamic flexibility of c sharp four, dealing with messi legacy system.

479
00:22:21.279 --> 00:22:23.519
<v Speaker 2>Running pragmatic tools when we really needed.

480
00:22:23.240 --> 00:22:26.480
<v Speaker 1>Them, and Finally, we unpacked the sheer elegance of acinc

481
00:22:26.519 --> 00:22:29.759
<v Speaker 1>state machines in C sharp five, leaving sticky notes to

482
00:22:29.839 --> 00:22:33.480
<v Speaker 1>tame the Chaosphersen screens. The entire evolution of C sharp

483
00:22:33.559 --> 00:22:35.799
<v Speaker 1>is the story of a language trying its hardest to

484
00:22:35.880 --> 00:22:39.599
<v Speaker 1>let you express your pure ideas while the compiler quietly

485
00:22:39.599 --> 00:22:42.160
<v Speaker 1>absorbs all the tedious machinery behind the curtain.

486
00:22:42.559 --> 00:22:45.720
<v Speaker 2>If we connect this to the bigger picture, it becomes

487
00:22:45.759 --> 00:22:48.839
<v Speaker 2>incredibly clear why looking under the hood matters. You could

488
00:22:48.880 --> 00:22:51.359
<v Speaker 2>easily just memorize the modern syntax and get by.

489
00:22:51.519 --> 00:22:54.640
<v Speaker 1>Sure, many people do, but understanding.

490
00:22:54.000 --> 00:22:57.359
<v Speaker 2>How a state machine works, or why nullable types were

491
00:22:57.400 --> 00:23:00.920
<v Speaker 2>invented to fix database hacks makes you a far more

492
00:23:00.920 --> 00:23:05.680
<v Speaker 2>confident and capable thinker, regardless of what technology you ultimately use.

493
00:23:06.359 --> 00:23:08.920
<v Speaker 1>So what does this all mean for the future. If

494
00:23:08.920 --> 00:23:12.480
<v Speaker 1>the entire history of software engineering is this unstoppable march

495
00:23:12.559 --> 00:23:15.279
<v Speaker 1>towards stripping away the fluff. If the ultimate goal is

496
00:23:15.359 --> 00:23:18.559
<v Speaker 1>letting the compiler do all the heavy lifting of translating

497
00:23:18.559 --> 00:23:21.880
<v Speaker 1>our raw human intent into machine instructions, what happens when

498
00:23:21.920 --> 00:23:23.240
<v Speaker 1>we reach the logical endpoint?

499
00:23:23.319 --> 00:23:24.160
<v Speaker 2>That's the big question.

500
00:23:24.400 --> 00:23:27.519
<v Speaker 1>Will the next generation of engineers even write syntax at all,

501
00:23:27.839 --> 00:23:31.079
<v Speaker 1>or will we simply describe our intent in plain English

502
00:23:31.119 --> 00:23:34.039
<v Speaker 1>to an artificial intelligence compiler and let it build the

503
00:23:34.039 --> 00:23:35.720
<v Speaker 1>state machines and delegates for us.

504
00:23:36.240 --> 00:23:40.000
<v Speaker 2>It is a profound paradigm shifting question, and one that

505
00:23:40.079 --> 00:23:42.559
<v Speaker 2>the evolution of languages like cicharves seems to have been

506
00:23:42.599 --> 00:23:43.920
<v Speaker 2>preparing us for all along.

507
00:23:44.240 --> 00:23:46.359
<v Speaker 1>Thank you for taking this deep dive with us today.

508
00:23:46.720 --> 00:23:48.680
<v Speaker 1>The next time you open up your favorite app or

509
00:23:48.680 --> 00:23:51.119
<v Speaker 1>get frustrated when a screen is loading, take a moment

510
00:23:51.119 --> 00:23:55.920
<v Speaker 1>to ponder the incredible invisible machinery working tirelessly behind the glass.

511
00:23:56.160 --> 00:23:59.319
<v Speaker 1>And remember the pianist. Don't just play the keys, keep

512
00:23:59.319 --> 00:24:00.400
<v Speaker 1>taking the piano apart.
