WEBVTT

1
00:00:00.080 --> 00:00:03.520
<v Speaker 1>Imagine you're building an application that handles like a million

2
00:00:03.560 --> 00:00:05.240
<v Speaker 1>transactions every single second.

3
00:00:05.360 --> 00:00:07.480
<v Speaker 2>Oh wow, Yeah, like a global banking app or a

4
00:00:07.519 --> 00:00:09.359
<v Speaker 2>massive multiplayer game or something.

5
00:00:09.199 --> 00:00:12.279
<v Speaker 1>Right exactly, And every time your code runs, it creates

6
00:00:12.279 --> 00:00:15.759
<v Speaker 1>this tiny temporary file in your system's memory just to

7
00:00:16.239 --> 00:00:18.879
<v Speaker 1>hold a couple of numbers right now, multiply that by

8
00:00:18.879 --> 00:00:22.160
<v Speaker 1>a million. Eventually a background process has to come through

9
00:00:22.239 --> 00:00:24.640
<v Speaker 1>and clean up those million tiny files, and when it does,

10
00:00:24.679 --> 00:00:26.480
<v Speaker 1>your entire server suddenly.

11
00:00:26.199 --> 00:00:28.039
<v Speaker 2>Just grinds to a complete halt.

12
00:00:28.199 --> 00:00:32.679
<v Speaker 1>Exactly. Users get disconnected, carts crash, it's a mess. So

13
00:00:32.719 --> 00:00:36.280
<v Speaker 1>today we're looking at how a seemingly minor tweak in

14
00:00:36.320 --> 00:00:39.200
<v Speaker 1>a programming language completely eliminates that problem.

15
00:00:39.280 --> 00:00:43.280
<v Speaker 2>It really is the butterfly effect of software development, you know,

16
00:00:43.679 --> 00:00:46.399
<v Speaker 2>a microscopic change, and how developer types a line of

17
00:00:46.439 --> 00:00:50.840
<v Speaker 2>code cascading upward to save entire server architectures from collapsing.

18
00:00:51.000 --> 00:00:54.000
<v Speaker 1>Welcome to today's deep dive. We are exploring the c

19
00:00:54.119 --> 00:00:58.920
<v Speaker 1>Sharp seven and dot net Core cookbook. It's written by

20
00:00:58.920 --> 00:01:02.600
<v Speaker 1>Dirk Strauss, who is a seasoned software developer and a

21
00:01:02.640 --> 00:01:03.600
<v Speaker 1>Microsoft MVP.

22
00:01:03.840 --> 00:01:05.920
<v Speaker 2>Yeah he really knows his stuff, he does.

23
00:01:06.640 --> 00:01:09.400
<v Speaker 1>But we aren't just like reading you a manual today.

24
00:01:09.760 --> 00:01:11.560
<v Speaker 1>The mission here is to help you cut through the

25
00:01:11.560 --> 00:01:15.560
<v Speaker 1>noise of modern software documentation. We're tracking an evolutionary leap

26
00:01:15.599 --> 00:01:18.120
<v Speaker 1>in how developers think about and write code.

27
00:01:17.840 --> 00:01:20.560
<v Speaker 2>And we're eventually going to zero in on one specific

28
00:01:20.680 --> 00:01:24.439
<v Speaker 2>highly anticipated feature from c Shark seven point zero release.

29
00:01:24.760 --> 00:01:28.359
<v Speaker 1>Right. And to really understand why this feature matters, we

30
00:01:28.439 --> 00:01:31.159
<v Speaker 1>have to look at the environment that well forced it

31
00:01:31.200 --> 00:01:31.959
<v Speaker 1>into existence.

32
00:01:32.159 --> 00:01:34.840
<v Speaker 2>Yeah, the macro context is huge. Here the forward of

33
00:01:34.879 --> 00:01:38.439
<v Speaker 2>this book, it's written by doctor James McCaffrey for Microsoft Research,

34
00:01:38.840 --> 00:01:41.480
<v Speaker 2>and he paints a pretty intense picture of the industry.

35
00:01:41.560 --> 00:01:42.159
<v Speaker 1>He really does.

36
00:01:42.200 --> 00:01:46.239
<v Speaker 2>He calls it this astonishing explosion of new technologies and

37
00:01:46.359 --> 00:01:49.280
<v Speaker 2>a title wave of various forms of documentation.

38
00:01:49.480 --> 00:01:51.519
<v Speaker 1>I mean, tidle wave almost feels like an understatement. If

39
00:01:51.560 --> 00:01:53.680
<v Speaker 1>you look at the sheer scope of what developers are

40
00:01:53.680 --> 00:01:58.959
<v Speaker 1>expected to manage today, it's it's honestly paralyzing. Oh. Absolutely,

41
00:01:58.959 --> 00:02:01.879
<v Speaker 1>You've got your legacy syst but now you're also expected

42
00:02:01.920 --> 00:02:05.120
<v Speaker 1>to build cross platform apps with net core one point

43
00:02:05.120 --> 00:02:08.960
<v Speaker 1>one that run seamlessly on Windows, Linux, mac op.

44
00:02:08.719 --> 00:02:11.400
<v Speaker 2>Right, and you're creating mobile apps using Zamorin and Cordova.

45
00:02:11.719 --> 00:02:15.479
<v Speaker 1>Yeah, and you're moving from old school monolithic architectures where

46
00:02:15.479 --> 00:02:18.439
<v Speaker 1>everything lives on one big server, to these cloud based

47
00:02:18.479 --> 00:02:21.479
<v Speaker 1>micro services on Azure service fabrics exactly.

48
00:02:21.599 --> 00:02:25.400
<v Speaker 2>Not to mention serverless computing right aws, Lambda S three

49
00:02:25.599 --> 00:02:29.120
<v Speaker 2>Azure functions. For a developer trying to stay relevant, it

50
00:02:29.199 --> 00:02:31.400
<v Speaker 2>really is just pure information overload.

51
00:02:31.560 --> 00:02:35.560
<v Speaker 1>So okay, let's unpack this. Yeah, because it's like standing

52
00:02:35.599 --> 00:02:39.039
<v Speaker 1>in front of this massive, globally themed all you can

53
00:02:39.039 --> 00:02:39.639
<v Speaker 1>eat buffet.

54
00:02:39.759 --> 00:02:41.120
<v Speaker 2>That's a great way to put it, right.

55
00:02:41.280 --> 00:02:44.439
<v Speaker 1>You've got sushi, tacos, roast, beef pasta, all just staring

56
00:02:44.479 --> 00:02:46.599
<v Speaker 1>at you. You're holding an empty plate, and if you

57
00:02:46.639 --> 00:02:49.319
<v Speaker 1>just start piling everything on without a strategy, it's gonna

58
00:02:49.319 --> 00:02:50.120
<v Speaker 1>be a complete.

59
00:02:49.800 --> 00:02:51.400
<v Speaker 2>Mess, a total disaster on a plate.

60
00:02:51.560 --> 00:02:55.479
<v Speaker 1>Yeah. So, how is a developer supposed to navigate this

61
00:02:55.599 --> 00:03:00.840
<v Speaker 1>massive landscape without feeling, you know, entirely paralyzed by all

62
00:03:00.879 --> 00:03:01.759
<v Speaker 1>this info overload?

63
00:03:01.919 --> 00:03:04.479
<v Speaker 2>Well, if we connect this to the bigger picture, this

64
00:03:04.560 --> 00:03:07.439
<v Speaker 2>is exactly why a cookbook approach is vital. A cookbook

65
00:03:07.479 --> 00:03:10.039
<v Speaker 2>doesn't ask you to eat the whole buffet. It offers quick,

66
00:03:10.319 --> 00:03:14.400
<v Speaker 2>targeted solutions, you know. But here's the underlying thread that

67
00:03:14.439 --> 00:03:17.719
<v Speaker 2>connects that massive buffet. Whether you are building a native

68
00:03:17.759 --> 00:03:21.800
<v Speaker 2>iOS app or an AWS lambda function. You are ultimately

69
00:03:21.840 --> 00:03:24.319
<v Speaker 2>relying on the foundational syntax of c sharp.

70
00:03:24.719 --> 00:03:27.520
<v Speaker 1>The language itself is the kitchen. So if we want

71
00:03:27.560 --> 00:03:29.639
<v Speaker 1>to survive this shift, we have to make sure our

72
00:03:29.759 --> 00:03:31.520
<v Speaker 1>kitchen tools are ruthlessly efficient.

73
00:03:31.800 --> 00:03:35.319
<v Speaker 2>Exactly, you can't afford memory leaks when you're running millions

74
00:03:35.319 --> 00:03:37.039
<v Speaker 2>of automated cloud function.

75
00:03:36.960 --> 00:03:40.560
<v Speaker 1>Right, And that architectural pressure actually forced the c Sharp

76
00:03:40.639 --> 00:03:43.879
<v Speaker 1>language designers to rethink something as basic as how a

77
00:03:43.919 --> 00:03:46.400
<v Speaker 1>method hands data back to a developer.

78
00:03:46.080 --> 00:03:48.439
<v Speaker 2>Which brings us to the blockbuster feature of c sharp

79
00:03:48.479 --> 00:03:51.639
<v Speaker 2>seven point zero. Matt's Turgerson, the Sea Sharp program manager,

80
00:03:51.680 --> 00:03:54.879
<v Speaker 2>went on a record saying that, alongside pattern matching, the

81
00:03:54.919 --> 00:03:56.960
<v Speaker 2>biggest feature by far.

82
00:03:56.520 --> 00:03:59.719
<v Speaker 1>Was tupples tuples. Okay, let's establish the technical floor here,

83
00:04:00.039 --> 00:04:03.879
<v Speaker 1>because the core problem top will solve is like incredibly relatable.

84
00:04:03.919 --> 00:04:05.560
<v Speaker 2>Oh yeah, every developer faces it.

85
00:04:05.680 --> 00:04:07.919
<v Speaker 1>Often. You write a function and you want that function

86
00:04:08.000 --> 00:04:10.759
<v Speaker 1>to give you back more than one piece of data, right, But.

87
00:04:10.759 --> 00:04:13.400
<v Speaker 2>A method naturally just wants to return one thing. It

88
00:04:13.479 --> 00:04:17.480
<v Speaker 2>calculates a result, hands it back, closes out right, But

89
00:04:17.639 --> 00:04:21.199
<v Speaker 2>real world logic rarely fits into a single result.

90
00:04:21.519 --> 00:04:26.399
<v Speaker 1>But wait, couldn't developers already return multiple values using other

91
00:04:26.519 --> 00:04:30.040
<v Speaker 1>clunky workarounds before this. I mean, I remember inheriting legacy

92
00:04:30.040 --> 00:04:32.680
<v Speaker 1>code where they used out parameters everywhere. Ah.

93
00:04:32.759 --> 00:04:35.360
<v Speaker 2>Yes, the classic out parameter trap.

94
00:04:35.399 --> 00:04:38.279
<v Speaker 1>It's so messy it breaks the entire flow. You have

95
00:04:38.360 --> 00:04:42.120
<v Speaker 1>to preemptively declare empty variables before you even call the method.

96
00:04:42.360 --> 00:04:44.240
<v Speaker 1>It sounds like going to a drive through and being

97
00:04:44.279 --> 00:04:47.040
<v Speaker 1>forced to make a separate transaction for your burger, your fries,

98
00:04:47.079 --> 00:04:49.120
<v Speaker 1>and your drink instead of just being able to order

99
00:04:49.160 --> 00:04:50.079
<v Speaker 1>the number two combo.

100
00:04:50.439 --> 00:04:52.639
<v Speaker 2>That is exactly what it felt like. And if you

101
00:04:52.759 --> 00:04:55.319
<v Speaker 2>didn't use out parameters, you had to build an entirely

102
00:04:55.439 --> 00:04:59.199
<v Speaker 2>new custom class or struct just to transport the data,

103
00:04:59.319 --> 00:05:02.879
<v Speaker 2>which is just boilerplate clutter exactly. So the tupple is

104
00:05:02.879 --> 00:05:05.519
<v Speaker 2>your number two combo. It's a lightweight structure that packages

105
00:05:05.600 --> 00:05:09.680
<v Speaker 2>multiple values together cleanly. But what's fascinating here isn't just

106
00:05:09.759 --> 00:05:13.279
<v Speaker 2>that tupples exist. It's the technical specifics of how they

107
00:05:13.279 --> 00:05:14.600
<v Speaker 2>are implemented.

108
00:05:14.279 --> 00:05:16.560
<v Speaker 1>Right, because not all data containers are created equal.

109
00:05:16.759 --> 00:05:21.519
<v Speaker 2>Precisely, in C sharp, tupples are implemented as strucks, meaning

110
00:05:21.680 --> 00:05:24.639
<v Speaker 2>they are value types rather than reference types.

111
00:05:24.720 --> 00:05:26.240
<v Speaker 1>Okay, that's a huge distinction.

112
00:05:26.439 --> 00:05:29.160
<v Speaker 2>It really is. It means they are created locally and

113
00:05:29.279 --> 00:05:31.519
<v Speaker 2>passed by copying the content.

114
00:05:31.279 --> 00:05:33.800
<v Speaker 1>So no heat allocation exactly.

115
00:05:33.399 --> 00:05:36.480
<v Speaker 2>No heat allocation, which means the garbage collector doesn't have

116
00:05:36.519 --> 00:05:39.680
<v Speaker 2>to come clean it up later. It is friction free

117
00:05:39.920 --> 00:05:45.399
<v Speaker 2>data transport. And they are completely mutable with public mutable fields.

118
00:05:45.160 --> 00:05:47.519
<v Speaker 1>Which makes perfect sense. If I hand you a combo meal,

119
00:05:47.879 --> 00:05:49.800
<v Speaker 1>you shouldn't have to jump through hoops just to change

120
00:05:49.800 --> 00:05:50.879
<v Speaker 1>out the fries for a salad.

121
00:05:51.000 --> 00:05:54.720
<v Speaker 2>Right, it's your local data exactly. It's lightweight, it's performance,

122
00:05:54.800 --> 00:05:55.879
<v Speaker 2>and it saves memory.

123
00:05:56.360 --> 00:05:58.240
<v Speaker 1>So what does this all mean, Like, how does this

124
00:05:58.279 --> 00:06:00.439
<v Speaker 1>actually change the code on a practice level.

125
00:06:00.680 --> 00:06:03.800
<v Speaker 2>Well, Strauss uses this really great scenario in the book

126
00:06:04.000 --> 00:06:05.399
<v Speaker 2>to demonstrate.

127
00:06:04.879 --> 00:06:06.439
<v Speaker 1>This, well, the student's score dilemma.

128
00:06:06.560 --> 00:06:09.040
<v Speaker 2>Yes, imagine you have a method that needs to calculate

129
00:06:09.079 --> 00:06:12.199
<v Speaker 2>the average score for a class, but because class sizes vary,

130
00:06:12.439 --> 00:06:15.759
<v Speaker 2>the method also needs to return the count of students processed.

131
00:06:16.000 --> 00:06:19.240
<v Speaker 1>Two pieces of data, the average and the count.

132
00:06:19.519 --> 00:06:22.600
<v Speaker 2>Right, And he provides this hard coded input array of

133
00:06:22.680 --> 00:06:24.639
<v Speaker 2>scores in the text just to ground it.

134
00:06:24.839 --> 00:06:28.360
<v Speaker 1>I actually have that right here. The array is seventeen

135
00:06:28.519 --> 00:06:31.720
<v Speaker 1>forty six thirty nine sixty two eighty one seventy nine,

136
00:06:31.800 --> 00:06:33.839
<v Speaker 1>fifty two, and twenty four perfect.

137
00:06:34.079 --> 00:06:37.360
<v Speaker 2>So with the new c sharp seven point zero return

138
00:06:37.439 --> 00:06:40.639
<v Speaker 2>type syntax, you just declare the methods return type using

139
00:06:40.680 --> 00:06:44.959
<v Speaker 2>a set of parentheses. You write public int innt, get

140
00:06:45.040 --> 00:06:45.519
<v Speaker 2>average and.

141
00:06:45.639 --> 00:06:49.560
<v Speaker 1>Account just int innt. That's so clean it is.

142
00:06:49.480 --> 00:06:52.879
<v Speaker 2>And inside the method as a dummy implementation, he shows

143
00:06:52.879 --> 00:06:55.920
<v Speaker 2>you can just write var return tuple equals zero zero

144
00:06:56.240 --> 00:06:57.399
<v Speaker 2>using a tupple literal.

145
00:06:57.600 --> 00:06:59.439
<v Speaker 1>Okay, but here's where I have to push back a

146
00:06:59.480 --> 00:07:02.040
<v Speaker 1>little on the implementation. Yeah, because the calling code still

147
00:07:02.040 --> 00:07:04.800
<v Speaker 1>has to consume it, and historically tuples rely on these

148
00:07:04.800 --> 00:07:05.959
<v Speaker 1>default properties, right.

149
00:07:05.920 --> 00:07:07.079
<v Speaker 2>Right, item one and item two.

150
00:07:07.160 --> 00:07:08.680
<v Speaker 1>Yeah, you have to type f item one for the

151
00:07:08.720 --> 00:07:10.879
<v Speaker 1>average and s item two for the count. That is

152
00:07:10.920 --> 00:07:13.839
<v Speaker 1>so confusing. Imagine reading that code three months later. Is

153
00:07:13.879 --> 00:07:16.319
<v Speaker 1>item one the average, that the count is the highest score.

154
00:07:16.480 --> 00:07:18.800
<v Speaker 2>It's completely opaque, You have zero context.

155
00:07:18.920 --> 00:07:20.199
<v Speaker 1>It's a breeding ground for bugs.

156
00:07:20.199 --> 00:07:23.600
<v Speaker 2>Oh absolutely, I completely agree. And that exact limitation of

157
00:07:23.639 --> 00:07:26.079
<v Speaker 2>default tuble naming is what leads to the final most

158
00:07:26.160 --> 00:07:29.040
<v Speaker 2>elegant feature of c sharp seven point zero tuples.

159
00:07:29.199 --> 00:07:31.879
<v Speaker 1>Here's where he gets really interesting, because.

160
00:07:31.600 --> 00:07:34.800
<v Speaker 2>They fixed this, right they did. You can declare variable

161
00:07:34.879 --> 00:07:37.040
<v Speaker 2>names directly in the return type now, so.

162
00:07:37.040 --> 00:07:40.839
<v Speaker 1>Instead of just inint INNT, you can write public int

163
00:07:40.959 --> 00:07:43.120
<v Speaker 1>average in student count, get average in count.

164
00:07:43.240 --> 00:07:46.279
<v Speaker 2>Exactly. You are attaching the semantic meaning right there in

165
00:07:46.319 --> 00:07:47.399
<v Speaker 2>the signature, and the.

166
00:07:47.360 --> 00:07:50.240
<v Speaker 1>Impact that has on the calling code is massive, because

167
00:07:50.279 --> 00:07:54.199
<v Speaker 1>you jump from generic item one tags to named elements

168
00:07:54.639 --> 00:07:57.600
<v Speaker 1>inside an interpolated string. You just type s dot average

169
00:07:57.639 --> 00:07:59.560
<v Speaker 1>in s student count, which.

170
00:07:59.319 --> 00:08:03.639
<v Speaker 2>Is incredible readable, and you can even name tupple literals internally,

171
00:08:03.759 --> 00:08:06.839
<v Speaker 2>like var return tupple, I've ave dot average, scout dot.

172
00:08:07.040 --> 00:08:09.279
<v Speaker 1>Right. It isn't just about making the code run faster,

173
00:08:09.360 --> 00:08:12.399
<v Speaker 1>It's about making it human readable for the nice person

174
00:08:12.439 --> 00:08:13.600
<v Speaker 1>who inherits the project.

175
00:08:13.839 --> 00:08:17.399
<v Speaker 2>And this raises an important question about how language features

176
00:08:17.519 --> 00:08:21.920
<v Speaker 2>fundamentally change team collaboration. Oh, for sure, writing code is

177
00:08:21.959 --> 00:08:25.279
<v Speaker 2>as much about communicating intent to other developers as it

178
00:08:25.360 --> 00:08:28.240
<v Speaker 2>is about giving instructions to a compiler, exactly.

179
00:08:28.600 --> 00:08:32.639
<v Speaker 1>But we do need warn people about a specific setup requirement.

180
00:08:32.279 --> 00:08:36.039
<v Speaker 2>Right, Yes, the gotcha, gotcha? If you are working in

181
00:08:36.120 --> 00:08:39.919
<v Speaker 2>Visual Studio twenty seventeen release candidate, this doesn't just work

182
00:08:40.000 --> 00:08:41.120
<v Speaker 2>right out of the box, right.

183
00:08:41.000 --> 00:08:43.759
<v Speaker 1>Because the core compiler didn't natively know how to process

184
00:08:43.879 --> 00:08:45.559
<v Speaker 1>value tech toples yet exactly.

185
00:08:45.759 --> 00:08:48.080
<v Speaker 2>So developers have to go to the new Get package

186
00:08:48.120 --> 00:08:52.759
<v Speaker 2>manager and actively install a package called system dot value tuple.

187
00:08:53.000 --> 00:08:56.440
<v Speaker 1>And hit accept on the Microsoft license agreement that pops up.

188
00:08:56.519 --> 00:08:59.039
<v Speaker 2>Yes, you have to accept the agreement for it to work.

189
00:08:59.080 --> 00:09:02.240
<v Speaker 2>It's a small hurb, but if you don't know it's required,

190
00:09:02.320 --> 00:09:06.399
<v Speaker 2>you'll be staring at compiler errors for hours completely baffled.

191
00:09:06.519 --> 00:09:08.759
<v Speaker 1>Yeah, well, I think that brings us full circle on

192
00:09:08.840 --> 00:09:11.799
<v Speaker 1>this deep dive. We started out looking at this overwhelming

193
00:09:11.919 --> 00:09:16.360
<v Speaker 1>macro world, right, micro services, serverless architecture, cross platform app,

194
00:09:16.519 --> 00:09:19.519
<v Speaker 1>giant buffet, the giant buffet, and we seemed all the

195
00:09:19.519 --> 00:09:22.759
<v Speaker 1>way down into the elegant micro level syntax of c

196
00:09:22.919 --> 00:09:24.960
<v Speaker 1>shark seven point zero tuples.

197
00:09:24.759 --> 00:09:29.000
<v Speaker 2>And mastering these precise quick solutions is exactly what makes

198
00:09:29.000 --> 00:09:30.600
<v Speaker 2>a developer truly formidable.

199
00:09:30.679 --> 00:09:32.440
<v Speaker 1>It really is, and it leads you with a final

200
00:09:32.720 --> 00:09:36.039
<v Speaker 1>somewhat provocative thought to mull over. Yeah, think about it.

201
00:09:36.080 --> 00:09:40.159
<v Speaker 1>If programming language syntax is constantly evolving to mirror natural

202
00:09:40.240 --> 00:09:44.960
<v Speaker 1>human logic, like seamlessly packaging and naming multiple related ideas

203
00:09:44.960 --> 00:09:47.679
<v Speaker 1>at once, like we saw with tuples, how close are

204
00:09:47.679 --> 00:09:51.720
<v Speaker 1>we to a future where code structure becomes almost indistinguishable

205
00:09:51.759 --> 00:09:52.879
<v Speaker 1>from plain English.

206
00:09:52.919 --> 00:09:55.039
<v Speaker 2>Wow, that's a huge question.

207
00:09:54.919 --> 00:09:57.799
<v Speaker 1>Right, And how are the tools you use today subtly

208
00:09:57.799 --> 00:10:00.679
<v Speaker 1>shaping the way you actually think about problems evolving in

209
00:10:00.720 --> 00:10:01.720
<v Speaker 1>your everyday life.

210
00:10:01.799 --> 00:10:04.279
<v Speaker 2>We shape our tools, and then our tools shape us.

211
00:10:04.720 --> 00:10:07.200
<v Speaker 1>Exactly something to think about the next time you write

212
00:10:07.200 --> 00:10:09.600
<v Speaker 1>a line of code. Thanks for joining us on this

213
00:10:09.679 --> 00:10:10.200
<v Speaker 1>deep dive.

214
00:10:10.240 --> 00:10:11.039
<v Speaker 2>Thanks for having me
