1
00:00:01,080 --> 00:00:03,000
Speaker 1: How'd you like to listen to dot net rocks with

2
00:00:03,040 --> 00:00:07,879
no ads? Easy? Become a patron for just five dollars

3
00:00:07,919 --> 00:00:10,800
a month. You get access to a private RSS feed

4
00:00:10,839 --> 00:00:14,240
where all the shows have no ads. Twenty dollars a month,

5
00:00:14,279 --> 00:00:17,679
we'll get you that and a special dot NetRocks patron mug.

6
00:00:18,160 --> 00:00:34,479
Sign up now at Patreon dot dot NetRocks dot com. Hey,

7
00:00:34,520 --> 00:00:39,039
welcome back to dot net Rocks episode number nineteen forty three.

8
00:00:39,359 --> 00:00:42,560
I'm Carl Franklin at amergri Gabel. How you doing, Richard?

9
00:00:42,719 --> 00:00:45,079
What's up? I'm all right. This is weird to be

10
00:00:45,159 --> 00:00:47,920
in the twentieth century of shows, but you know, yeah,

11
00:00:48,039 --> 00:00:50,560
and so much happened during these years. Yeah, so we'll

12
00:00:50,560 --> 00:00:53,119
talk about that in a minute. But uh, how's the

13
00:00:53,119 --> 00:00:57,320
weather up there in otter Town? Yea, we gotta break today,

14
00:00:57,520 --> 00:01:01,359
little suddy. You know it's it's definitely springtime. So yeah,

15
00:01:01,359 --> 00:01:02,679
here too, things are changing.

16
00:01:02,920 --> 00:01:05,239
Speaker 2: We had one snowfall, which is kind of normal for

17
00:01:05,280 --> 00:01:08,120
the coast, and now it's things are warming.

18
00:01:07,920 --> 00:01:10,719
Speaker 1: Up here too, and it's kind of nice. Yeah. I

19
00:01:10,799 --> 00:01:15,480
install the camera right outside the studio nice and brought

20
00:01:15,519 --> 00:01:17,640
the big screen TV and from the living room, which

21
00:01:17,680 --> 00:01:20,079
we don't really use anymore and sort of mounted it

22
00:01:20,159 --> 00:01:22,239
right in back of where the camera is, so I

23
00:01:22,280 --> 00:01:25,680
have like a digital window out on my outside.

24
00:01:25,840 --> 00:01:27,840
Speaker 2: But you can control the amount of light, and so

25
00:01:28,120 --> 00:01:30,879
you got control over your space till right, Yeah, exactly.

26
00:01:31,079 --> 00:01:33,560
Speaker 1: So it's fun. All right, it's good. Let's talk about

27
00:01:33,599 --> 00:01:35,959
nineteen forty three before we do better. No framework going

28
00:01:36,040 --> 00:01:38,200
to do that first, sure, all right, Well, from what

29
00:01:38,280 --> 00:01:40,680
I know and what I read, nineteen forty three, the

30
00:01:40,799 --> 00:01:43,480
tide of World War two began to turn against the

31
00:01:43,519 --> 00:01:47,840
Axis powers, with significant events including the Soviet victory at

32
00:01:47,879 --> 00:01:51,879
the Battle of Stalingrad, the Allied invasion of Sicily, and

33
00:01:51,920 --> 00:01:56,640
the beginning of the Warsaw Ghetto uprising. The word ghetto

34
00:01:56,760 --> 00:01:59,480
comes from Poland. Not a lot of people know that

35
00:01:59,560 --> 00:02:01,680
in America anyway. And what's crazy when you go to

36
00:02:01,680 --> 00:02:04,480
Warsaw is the chunks of it that are still there. Yeah,

37
00:02:04,599 --> 00:02:08,039
the Polish are taken very seriously the ownership of those buildings,

38
00:02:08,120 --> 00:02:10,759
and well, it's entirely likely there's no one left alive

39
00:02:10,879 --> 00:02:12,719
that owned some of those buildings. They just won't do

40
00:02:12,719 --> 00:02:15,560
anything about it. Yeah, they're holding off on the chance

41
00:02:15,599 --> 00:02:17,680
that they could find some relations to the point now

42
00:02:17,680 --> 00:02:21,800
where they've built these protective screens up one floor over

43
00:02:21,840 --> 00:02:24,319
the sidewalk because there's Yeah, it's the building falling off.

44
00:02:24,319 --> 00:02:26,639
They don't want to hurt anybody. Wow, there's still billet

45
00:02:26,639 --> 00:02:29,560
holes in buildings in Warsaw from that. At that time,

46
00:02:30,400 --> 00:02:34,680
Zootsuit riots happened in Los Angeles. White servicemen and police

47
00:02:34,680 --> 00:02:38,840
officers attacked Mexican American youth, which turned that into the

48
00:02:38,919 --> 00:02:42,560
Zootsuit riots. The Harlem race Riot occurred in Harlem, New

49
00:02:42,639 --> 00:02:45,680
York after a white police officer shot in African American soldier.

50
00:02:46,599 --> 00:02:49,960
In the good News section of nineteen forty three, the

51
00:02:50,000 --> 00:02:54,319
Pentagon is completed, the Chinese exclusion acts are repealed. Actually

52
00:02:54,439 --> 00:02:56,800
is that good news? Does sound like it? I'm not

53
00:02:56,879 --> 00:03:00,879
so sure. But also two things were invented in nineteen

54
00:03:00,960 --> 00:03:04,479
forty three that we need to thank the people for

55
00:03:04,879 --> 00:03:07,080
duct tape, nice and LSD.

56
00:03:07,479 --> 00:03:13,800
Speaker 2: It's funny also when the Colossus computer, which arguably is

57
00:03:13,800 --> 00:03:20,639
the first electronic programmable computing device, of course, built Blenchley

58
00:03:20,680 --> 00:03:24,840
Park for cryptanalysis. Wow, although that's also the same. Forty

59
00:03:24,879 --> 00:03:27,240
three is a year where the contract for ANIAC starts,

60
00:03:27,240 --> 00:03:28,960
but they won't get finished until forty five.

61
00:03:29,120 --> 00:03:31,000
Speaker 1: Yeah, and I don't know.

62
00:03:31,080 --> 00:03:33,759
Speaker 2: This is also forty three was the era of the

63
00:03:33,800 --> 00:03:35,599
first generation of antibiotics.

64
00:03:35,680 --> 00:03:36,159
Speaker 1: That's right.

65
00:03:36,319 --> 00:03:39,560
Speaker 2: Yeah, yeah, so, and there's some funny stories around that,

66
00:03:39,599 --> 00:03:45,919
like they found the perfect bacterium for growing penicillin on

67
00:03:46,960 --> 00:03:47,599
a cantalope.

68
00:03:47,719 --> 00:03:51,240
Speaker 1: I thought it was on an orange randomly. There were

69
00:03:51,240 --> 00:03:53,439
are versions there, but the thing they call the golden mold,

70
00:03:53,560 --> 00:03:56,439
it was actually on a canalope in Illinois. That's so cool,

71
00:03:56,520 --> 00:03:58,639
and that maybe they already knew how to make penicill

72
00:03:58,639 --> 00:04:02,439
at that point. But it became the master mechanism destructimyas

73
00:04:02,439 --> 00:04:05,280
and was developed in forty three. I think that it

74
00:04:05,360 --> 00:04:07,400
was really released in forty four, wasn't it.

75
00:04:07,479 --> 00:04:10,759
Speaker 2: Yeah, but that's when it was first developed and it

76
00:04:10,840 --> 00:04:13,360
was the first treatment for tuberculosis.

77
00:04:13,439 --> 00:04:15,840
Speaker 1: Wow, take a lot of that stuff for granted, now,

78
00:04:15,840 --> 00:04:18,720
don't we We share doom to the point where people forget. Yeah,

79
00:04:18,879 --> 00:04:20,959
we used to have friends that died. He stepped on

80
00:04:20,959 --> 00:04:22,920
a nail. You were going to die? Yeah, and you

81
00:04:23,160 --> 00:04:27,040
everybody had somebody who died in tuberculosis. Many people oculosis.

82
00:04:27,120 --> 00:04:31,439
It was untreatable, tetanus too. Yeah. Okay, so let's get

83
00:04:31,480 --> 00:04:42,399
to better know a framework, roll the music. Awesome, A man,

84
00:04:42,439 --> 00:04:45,399
what you got? This one comes from our friend Damian Edwards.

85
00:04:45,720 --> 00:04:48,160
You know him. He's overdue for a show, isn't name?

86
00:04:48,199 --> 00:04:51,680
We should totally is. Yeah, we need a little signal,

87
00:04:51,680 --> 00:04:56,079
our reminiscence and all that good stuff. So he wrote

88
00:04:56,120 --> 00:05:00,519
this tool. It's on GitHub called dot net purge. It's

89
00:05:00,519 --> 00:05:02,360
a dot Net tool that runs dot net clean for

90
00:05:02,439 --> 00:05:07,319
each target, framework and configuration and then deletes the output directories. Okay.

91
00:05:07,439 --> 00:05:10,079
Can be run in a directory containing a solution or

92
00:05:10,120 --> 00:05:13,759
project file because you know what disk space is low. No,

93
00:05:13,839 --> 00:05:17,319
I'm kidding. I'm kidding, of course, Damien. That's not the point.

94
00:05:17,360 --> 00:05:21,000
The point is you have all these dangling frameworks and

95
00:05:21,959 --> 00:05:25,399
tools that you don't need anymore. Yeah, why confuse the issue?

96
00:05:25,639 --> 00:05:28,319
Just clean them up, Just tidy stuff up. Yeah, so

97
00:05:28,399 --> 00:05:31,560
that's cool. As you can see, it's a it's a

98
00:05:31,600 --> 00:05:33,600
dot net tool. It's a command line thing. You can

99
00:05:33,639 --> 00:05:37,160
add it to Windows Explore. There's a little registry hack

100
00:05:37,279 --> 00:05:40,000
that you can add dot net purge to Explore a

101
00:05:40,040 --> 00:05:42,879
context menu. Turn it into a shortcut. Yeah, very cool.

102
00:05:43,000 --> 00:05:45,439
You know, at least it'll it'll it'll help with your

103
00:05:45,879 --> 00:05:48,120
large lene you're programming large language model lature is not

104
00:05:48,199 --> 00:05:52,000
navigating old files. Ooh, there you go. Yeah. And also

105
00:05:52,079 --> 00:05:56,279
Simon Crop was a contributor to that. There's Damien and

106
00:05:56,319 --> 00:05:58,879
Simon basically another guy you should probably be back on

107
00:05:58,920 --> 00:06:01,560
the show. Yeah, so there you go. Clearly they both

108
00:06:01,639 --> 00:06:04,279
had the problem and decided to fix it. Yeah. Maybe

109
00:06:04,279 --> 00:06:06,720
it only happens in Australia, though I don't know. I

110
00:06:06,720 --> 00:06:10,360
don't know the answer. Okay, he's talking to us today.

111
00:06:10,399 --> 00:06:12,600
Richard grabbed a comment on a show eighteen eighty five,

112
00:06:12,639 --> 00:06:14,519
the one we did with Martine back in February of

113
00:06:14,519 --> 00:06:18,600
twenty four. We were talking about improving your CSS skills. Yeah,

114
00:06:18,879 --> 00:06:22,680
and Vladimir Jirgov commented this about a year ago. Hees hi, guys,

115
00:06:22,680 --> 00:06:24,639
long term listening to the show, writing in reference to

116
00:06:24,759 --> 00:06:28,680
using chat GPT for creating CSS code. I found this

117
00:06:28,720 --> 00:06:31,360
comment hilarious because it was a year ago when we

118
00:06:31,600 --> 00:06:34,480
just didn't know. I've recently used the free version of

119
00:06:34,560 --> 00:06:38,600
chat gpt for a small CSS h schmael and JavaScript project. Well,

120
00:06:38,600 --> 00:06:40,560
I could say it's pretty good perspectives matter.

121
00:06:40,920 --> 00:06:43,680
Speaker 2: I'm an infrastructure engineer recently turned web developer, so my

122
00:06:43,680 --> 00:06:48,319
appraisal of quote good CSS code is limited. Nevertheless, chat

123
00:06:48,399 --> 00:06:51,360
GPD was able to produce clear, readable, almost eighty percent

124
00:06:51,560 --> 00:06:54,399
accurate code. The other twenty percent I compensated by pointing

125
00:06:54,439 --> 00:06:55,920
me to the right direction to fix it or just

126
00:06:55,959 --> 00:06:57,160
it when I couldn't do it itself.

127
00:06:57,519 --> 00:07:00,199
Speaker 1: All this is good. It really blew me away a positively.

128
00:07:00,240 --> 00:07:02,319
When I asked to refactor the code, it gave me

129
00:07:02,399 --> 00:07:05,959
clear and concise, simplified Yeah, and ask it to comment

130
00:07:06,040 --> 00:07:09,519
it as well, that's another trick. Yeah. Well, and again,

131
00:07:09,920 --> 00:07:13,279
imagine this is a year ago, like so much has

132
00:07:13,319 --> 00:07:16,240
happened in this space in a year. That's the problem

133
00:07:16,279 --> 00:07:20,000
I find with chatchipt and things like CSS, because there's

134
00:07:20,079 --> 00:07:23,759
so many posts like on stack overflow of people who

135
00:07:23,800 --> 00:07:27,800
are posting bad CSS right and saying why is in

136
00:07:27,879 --> 00:07:29,839
this work? And then their discussions and by the time

137
00:07:29,879 --> 00:07:32,560
you get to the to the good one, you know,

138
00:07:32,639 --> 00:07:35,480
to the solution, it might be three years old. And

139
00:07:35,600 --> 00:07:40,800
so there's just a lot of confused CSS on the internet.

140
00:07:41,040 --> 00:07:44,279
So I'm probably true for all code. But in general,

141
00:07:44,399 --> 00:07:48,079
these tools have moved so quickly, and being aware that

142
00:07:48,120 --> 00:07:50,360
we're coming up on a bills and there's some interesting

143
00:07:50,360 --> 00:07:53,800
announcements coming, like you know, Microsoft's a tooling company first

144
00:07:53,839 --> 00:07:57,040
and foremost, so expect amazing things in this space.

145
00:07:57,240 --> 00:07:59,360
Speaker 2: Yep, that's for sure, Vladimir, Thank you so much for

146
00:07:59,399 --> 00:08:01,279
your comment, and a copy of music Cobey is on

147
00:08:01,319 --> 00:08:03,040
its way to you. And if you'd like copy music Cobey,

148
00:08:03,040 --> 00:08:04,639
I write a comment on the website at dot at

149
00:08:04,720 --> 00:08:07,120
rocks dot com or on the facebooks. We publish every

150
00:08:07,120 --> 00:08:09,160
show there and if I comment there or if you

151
00:08:09,240 --> 00:08:10,800
comment there and I read it on the show, we'll

152
00:08:10,800 --> 00:08:11,920
send you copy of music go bay.

153
00:08:11,959 --> 00:08:14,600
Speaker 1: And of course music to Code by born of a

154
00:08:14,639 --> 00:08:19,240
conversation that we had on dot net rocks and it

155
00:08:19,319 --> 00:08:23,839
turns out that music at a certain with certain attributes

156
00:08:23,879 --> 00:08:27,279
really help you focus, and it's based on science. Was

157
00:08:27,279 --> 00:08:29,639
that Dan North or was it Mark Semen? Mark Semen?

158
00:08:30,240 --> 00:08:32,879
Was Mark Semen? Yeah? Yeah, So you know, we just

159
00:08:32,960 --> 00:08:35,679
did track twenty two. So you can get that track

160
00:08:35,759 --> 00:08:38,960
by itself, or you can get MP three flak or

161
00:08:39,039 --> 00:08:43,120
wave collections. Go to music to Code by dot net. Okay, awesome,

162
00:08:43,240 --> 00:08:49,279
Let's bring back Martine Dowdin, an award winning CTO ux

163
00:08:49,600 --> 00:08:54,639
UI designer and developer, International speaker and author. Martin focuses

164
00:08:54,720 --> 00:08:59,360
on web interfaces. That are beautiful, functional, accessible, and usable.

165
00:09:00,039 --> 00:09:03,000
She approaches user experience from both art and science, drawing

166
00:09:03,039 --> 00:09:06,879
from her degrees in psychology and visual communications. Martin has

167
00:09:06,919 --> 00:09:10,159
worked as a developer, artist, educator, and consultants since two

168
00:09:10,240 --> 00:09:15,000
thousand and five. Currently, she's the CTO at Andromeda Galactic

169
00:09:15,120 --> 00:09:19,879
Solutions good name where she that's a great name as

170
00:09:19,919 --> 00:09:25,879
opposed to like Minutia Incorporated right where she continues to

171
00:09:25,960 --> 00:09:28,559
learn work on. Sorry, I didn't mean to make you laugh,

172
00:09:29,879 --> 00:09:32,320
continues to learn work on and share her passion for

173
00:09:32,360 --> 00:09:34,480
front end development. Welcome back, Martin.

174
00:09:34,279 --> 00:09:36,159
Speaker 3: Well glad to be back. Thank you for having me.

175
00:09:36,399 --> 00:09:36,679
Speaker 1: Sure.

176
00:09:36,879 --> 00:09:39,320
Speaker 2: Yeah, it's great to have you back, and I'm happy

177
00:09:39,360 --> 00:09:41,559
to not be talking about CSS this time around. Not

178
00:09:41,600 --> 00:09:45,639
that your conversation CSS aren't brilliant. Yeah, but admittedly I

179
00:09:45,639 --> 00:09:48,360
think I pinged you saying it's been about a year

180
00:09:48,600 --> 00:09:51,600
and I had been poking through your sessionized and saw

181
00:09:51,799 --> 00:09:55,039
you doing a talk on promises and I'm like, you know,

182
00:09:56,039 --> 00:09:58,519
those things have driven me crazy since they were first

183
00:09:58,600 --> 00:10:00,440
talked about in the W three C.

184
00:10:01,759 --> 00:10:02,799
Speaker 1: I should talk to Martina.

185
00:10:03,200 --> 00:10:04,519
Speaker 2: It's like, as soon as I get that urge, like

186
00:10:04,559 --> 00:10:05,879
I want to call you and talk about it we

187
00:10:05,879 --> 00:10:07,360
should probably make a show.

188
00:10:10,399 --> 00:10:12,919
Speaker 1: So, Martine, what is on your mind these days?

189
00:10:13,759 --> 00:10:17,600
Speaker 3: Well, the I've been writing blog posts and one of

190
00:10:17,639 --> 00:10:20,559
them that you mentioned was about promises and also made

191
00:10:20,559 --> 00:10:24,240
it as a talk, and so I realized when I

192
00:10:24,320 --> 00:10:27,200
was I was, I've been working with some junior devs

193
00:10:27,200 --> 00:10:31,159
and some dot devs recently, and uh, we were arguing about,

194
00:10:31,480 --> 00:10:33,759
you know, better ways to write code and how something

195
00:10:33,759 --> 00:10:36,759
should be architected, because you know, de've never disagree on

196
00:10:36,799 --> 00:10:37,519
such things.

197
00:10:37,320 --> 00:10:39,480
Speaker 1: Never, never, never, never.

198
00:10:40,000 --> 00:10:44,000
Speaker 3: And I realized that one one of the one of

199
00:10:44,000 --> 00:10:48,039
the guys I was talking to, didn't actually understand what

200
00:10:48,159 --> 00:10:52,200
promises did or how they worked. And so that's kind

201
00:10:52,200 --> 00:10:55,519
of what prompted me to write that article because as

202
00:10:55,519 --> 00:10:58,320
I did some digging, I realized that not only do

203
00:10:58,960 --> 00:11:01,200
it's not as common knowledge as I originally thought it

204
00:11:01,320 --> 00:11:04,399
was on how they work, but also that there's so

205
00:11:04,559 --> 00:11:07,440
much with them that can be done that like, sure

206
00:11:07,519 --> 00:11:09,879
people can remember how to do a dot then or

207
00:11:10,039 --> 00:11:12,399
dot catch or maybe even in a sink away, but

208
00:11:12,399 --> 00:11:14,320
there's so much more to them than those three things,

209
00:11:14,360 --> 00:11:16,480
which is kind of what a lot of people think

210
00:11:16,519 --> 00:11:18,559
of when they think promises, Right, you get your fetch

211
00:11:18,559 --> 00:11:20,919
you get your then and go on and go forth

212
00:11:20,919 --> 00:11:22,919
and conquer. But there's a lot more to it that

213
00:11:22,960 --> 00:11:26,000
you can do in terms of parallelization or how you

214
00:11:26,039 --> 00:11:28,039
want things to happen, or if you want, you know,

215
00:11:28,360 --> 00:11:30,320
just give me the first response or things like that.

216
00:11:30,440 --> 00:11:32,919
And so that's kind of what prompted me to write it.

217
00:11:33,000 --> 00:11:35,639
Speaker 1: And just to back up, we're talking about JavaScript here,

218
00:11:35,879 --> 00:11:38,360
yes we are. You know, we didn't really introduce the

219
00:11:38,399 --> 00:11:40,679
topic unless you read the title of the show, but

220
00:11:41,279 --> 00:11:44,399
so we're talking JavaScript promises, and you know this is

221
00:11:44,440 --> 00:11:47,240
the way to do one way to do things asynchronously.

222
00:11:47,360 --> 00:11:50,759
Right you mentioned a sink a weight, which we do

223
00:11:50,799 --> 00:11:54,120
and c sharp all the time, but turned into JavaScript as.

224
00:11:54,000 --> 00:11:56,919
Speaker 3: Well, yep, which is it's kind of cool. I just

225
00:11:57,000 --> 00:11:59,559
I mean, the thing with them is the I found

226
00:11:59,559 --> 00:12:02,639
that the ear handling becomes a little different if you're

227
00:12:02,679 --> 00:12:04,840
doing the a a sek away where you have to

228
00:12:04,879 --> 00:12:07,799
wrap the trycatch and so on, and then depending if

229
00:12:07,840 --> 00:12:09,759
you want to where you want to catch your things

230
00:12:09,759 --> 00:12:12,519
and how ends up being a little bit different. But oh,

231
00:12:12,559 --> 00:12:15,240
in all, I find they I personally like it because

232
00:12:15,279 --> 00:12:17,360
I find it more readable to just be able to go,

233
00:12:17,440 --> 00:12:19,799
you know, especially if you have multiple private promises you're

234
00:12:19,799 --> 00:12:22,360
doing in sequence to just be able to do a

235
00:12:22,399 --> 00:12:24,720
weight one A wait two, a wait three, And it's

236
00:12:24,840 --> 00:12:27,519
really instead of having to do the whole that then

237
00:12:27,639 --> 00:12:29,679
that then that then that then I find it less worthy,

238
00:12:30,240 --> 00:12:32,120
but it's a personal preference really.

239
00:12:32,080 --> 00:12:34,600
Speaker 1: So the whole dot then that that is that the

240
00:12:34,679 --> 00:12:37,679
promise syntax like fluent. Is that how it works.

241
00:12:37,919 --> 00:12:41,799
Speaker 3: Yeah, So in JavaScript, fetch is a promise. I'm just

242
00:12:41,799 --> 00:12:43,320
going to use that as the example because it's the

243
00:12:43,360 --> 00:12:45,080
same one I have in the in the article. But

244
00:12:45,159 --> 00:12:48,159
you would do like fetch whatever the U R L, right,

245
00:12:48,240 --> 00:12:51,639
and then you would do after that you do dot

246
00:12:51,679 --> 00:12:53,840
then and then you're going to get the results and

247
00:12:53,879 --> 00:12:55,799
that that's that's going to be a function. So you

248
00:12:55,840 --> 00:12:58,039
get your result and you can do whatever you want

249
00:12:58,039 --> 00:13:00,000
with that result at that point, right, And you can

250
00:13:00,159 --> 00:13:02,799
chain those dot dens, so if you get what you

251
00:13:02,960 --> 00:13:05,960
sometimes see is like where it starts, people try to

252
00:13:06,080 --> 00:13:08,440
nest the dot dens instead of chaining them, so you

253
00:13:08,519 --> 00:13:11,559
get kind of that that Christmas tree pattern like that,

254
00:13:13,679 --> 00:13:16,840
but you can just know and the fun thing with

255
00:13:16,919 --> 00:13:19,120
that then and it doesn't actually require you to return

256
00:13:19,159 --> 00:13:22,279
a promise. You can put promise one that then promise

257
00:13:22,320 --> 00:13:24,840
you know, take my results and then put it in

258
00:13:24,879 --> 00:13:27,639
for promise too and so on. But you can very easily,

259
00:13:28,080 --> 00:13:31,759
very easily just do some kind of transformation on the

260
00:13:31,840 --> 00:13:34,159
data and return that site. Once you're in that that

261
00:13:34,320 --> 00:13:37,720
then sequence. It does not have to be a promise.

262
00:13:37,840 --> 00:13:40,600
You can do then whatever you want to after that.

263
00:13:40,679 --> 00:13:42,960
Speaker 1: At that point it kind of sounds like a task

264
00:13:43,080 --> 00:13:47,360
and see sharp the concept anyway, where you know, when

265
00:13:47,399 --> 00:13:50,519
you have a promise, what do you do with it? Right?

266
00:13:50,919 --> 00:13:52,720
That's yeah.

267
00:13:52,960 --> 00:13:57,240
Speaker 3: For JavaScript, the most common use would be for like

268
00:13:57,360 --> 00:14:01,480
fetching data, like whether whether it's whether you're doing using

269
00:14:01,480 --> 00:14:04,919
a framework or something or you're just doing raw JavaScript.

270
00:14:05,559 --> 00:14:08,279
Most of the time it's because you're fetching data that's

271
00:14:08,440 --> 00:14:10,440
ninety nine percent of the timeline, it's going to be

272
00:14:10,440 --> 00:14:11,000
four and.

273
00:14:10,879 --> 00:14:12,440
Speaker 1: You're trying not to hang the UI.

274
00:14:12,600 --> 00:14:15,240
Speaker 2: Why you do it right that I send off the

275
00:14:15,320 --> 00:14:16,679
fetch you can.

276
00:14:16,799 --> 00:14:21,240
Speaker 3: It doesn't matter that more depends on how you're calling

277
00:14:21,279 --> 00:14:25,240
the function more than more and where more than the

278
00:14:25,320 --> 00:14:27,159
fact that it's a promise. The other one would be

279
00:14:27,200 --> 00:14:29,279
to turn that I use it a lot for is

280
00:14:29,320 --> 00:14:33,960
to turn callbacks into a promise because they're easier to

281
00:14:34,000 --> 00:14:37,519
chain and handle and deal with. I find so like

282
00:14:38,360 --> 00:14:41,399
when you're doing an image upload or a file upload

283
00:14:41,399 --> 00:14:43,559
and you want to do a preview for it, there's

284
00:14:43,600 --> 00:14:46,200
the whole file reader thing, and that's always a that's

285
00:14:46,240 --> 00:14:47,840
one of the common ones, or even the set time

286
00:14:47,879 --> 00:14:50,960
out technically speaking, you know, is callback. So like those

287
00:14:50,960 --> 00:14:53,519
sorts of things so that I can chain them easily

288
00:14:53,720 --> 00:14:56,559
with other things. I'll tend to turn them into promises

289
00:14:56,600 --> 00:14:59,320
because it makes my life a whole lot easier than

290
00:14:59,559 --> 00:15:01,960
living in and trying to figure out which callback is

291
00:15:02,000 --> 00:15:05,399
doing what and going where. And I find them gross personally,

292
00:15:05,480 --> 00:15:07,240
But just.

293
00:15:07,159 --> 00:15:11,120
Speaker 1: A just a for full disclosure, It's been a long

294
00:15:11,120 --> 00:15:14,879
time since I've looked at that kind of complexity in JavaScript.

295
00:15:14,879 --> 00:15:18,120
I mean, ever since I found Blazer, I've been as

296
00:15:18,200 --> 00:15:21,240
much c Sharp as possible and as little JavaScript as possible,

297
00:15:21,559 --> 00:15:24,279
And usually the JavaScript that I'm calling is just something

298
00:15:24,360 --> 00:15:27,440
to get something from the dom that I can't get

299
00:15:27,480 --> 00:15:28,080
with sea Sharp.

300
00:15:28,159 --> 00:15:32,759
Speaker 3: Yeah, dumb manipulation doesn't have too much in terms of

301
00:15:32,879 --> 00:15:35,840
callbacks or anything else. They have a couple, I guess,

302
00:15:35,960 --> 00:15:37,799
especially when you're getting to events like.

303
00:15:38,039 --> 00:15:40,879
Speaker 1: Yeah, window do resize all that stuff.

304
00:15:41,440 --> 00:15:44,360
Speaker 3: Or even what a fun one. That's always a h

305
00:15:44,960 --> 00:15:47,200
Be careful how you type that in your Google searches

306
00:15:47,240 --> 00:15:51,960
everything related to drag and drop because dom drag events

307
00:15:52,000 --> 00:15:55,240
can can make some fun fun Oh yeah, fun search

308
00:15:55,279 --> 00:15:56,480
results if you're not careful.

309
00:15:56,799 --> 00:16:04,799
Speaker 1: Oh boy, yep, Tom drag pictures of Dom Delawi's. So

310
00:16:04,840 --> 00:16:07,039
does the fetch approach have an advantage when you want

311
00:16:07,080 --> 00:16:09,720
to call off like multiple data sets you want to

312
00:16:09,720 --> 00:16:11,480
fetch and you don't really care what order they come

313
00:16:11,519 --> 00:16:14,360
back in you're populating different divs kind of thing. Yes,

314
00:16:14,399 --> 00:16:15,840
if that word shines.

315
00:16:16,679 --> 00:16:20,679
Speaker 3: So fetch literally just goes and gets the data. So

316
00:16:20,720 --> 00:16:23,399
if you wanted to call multiples, what you might do

317
00:16:23,759 --> 00:16:26,759
is do it in a You could do a promise

318
00:16:26,799 --> 00:16:29,279
that all which you would put a series of fetches

319
00:16:29,320 --> 00:16:31,879
in it, and it would only return the data once

320
00:16:32,000 --> 00:16:33,039
all of them have returned.

321
00:16:33,960 --> 00:16:34,639
Speaker 1: That's convenient.

322
00:16:35,120 --> 00:16:37,840
Speaker 3: So if you had to get if you needed all

323
00:16:37,840 --> 00:16:41,159
three sets of data in order to populate or do

324
00:16:41,240 --> 00:16:43,840
whatever you were going to do, that wouldn't return until

325
00:16:43,879 --> 00:16:46,159
all of them have returned. Now, the downside is if

326
00:16:46,200 --> 00:16:48,879
one of it fails, it fails everything. So that can

327
00:16:48,919 --> 00:16:51,279
be good or bad, right, It depends on your use case,

328
00:16:51,639 --> 00:16:51,919
but it.

329
00:16:51,919 --> 00:16:53,879
Speaker 2: Is nice if you do need three sets and you

330
00:16:53,879 --> 00:16:55,840
don't want to wait for each one to come back,

331
00:16:55,879 --> 00:16:57,960
to do it that way and they run in parallel

332
00:16:57,960 --> 00:17:00,200
and once they're all back, then you act. If you

333
00:17:00,279 --> 00:17:02,879
got three different sets that just render in three different

334
00:17:02,879 --> 00:17:04,799
dips and you don't care whatever that comes in, can

335
00:17:04,839 --> 00:17:05,519
you still use it?

336
00:17:05,839 --> 00:17:10,400
Speaker 3: Then you would probably do three. You would do either

337
00:17:10,440 --> 00:17:13,119
three functions or three fetches, and then in the response

338
00:17:13,160 --> 00:17:15,440
from the that fetch. But what I wouldn't do is

339
00:17:15,480 --> 00:17:18,119
try to go a sink a wait for a second

340
00:17:18,119 --> 00:17:20,559
and third because then you're literally waiting for a second

341
00:17:20,640 --> 00:17:22,839
and third. Right, So at that point I would probably

342
00:17:22,880 --> 00:17:25,799
do either separated into three functions that I would call

343
00:17:25,960 --> 00:17:29,200
and not wait on right, or if I wanted everything

344
00:17:29,240 --> 00:17:32,839
in the same function, I would do, uh, fetch a dot,

345
00:17:32,880 --> 00:17:35,319
then do whatever I'm gonna do, fetch b dot, then

346
00:17:35,359 --> 00:17:36,759
do what I'm going to do and do it as

347
00:17:36,759 --> 00:17:39,759
a dot. Then structure, because then they're not waiting on

348
00:17:39,839 --> 00:17:42,359
each other because JavaScript is going to fire the first one,

349
00:17:42,400 --> 00:17:45,039
the second one, the third one because it has the dot.

350
00:17:45,079 --> 00:17:47,519
Then it's not waiting for that to be finished. It's

351
00:17:47,559 --> 00:17:49,400
just going to fire and go and move on to

352
00:17:49,440 --> 00:17:53,599
the next but it will wait. Where it will wait

353
00:17:53,720 --> 00:17:57,279
is to do what's in that dot then then I'll

354
00:17:57,319 --> 00:17:59,119
wait for that data to come in. So if I

355
00:17:59,160 --> 00:18:01,599
wanted them in peril, well, i'd probably use and in

356
00:18:01,680 --> 00:18:04,160
the same function, I'd use dot then and definitely not

357
00:18:04,240 --> 00:18:06,640
a sync away because then you're forcing for the way.

358
00:18:06,759 --> 00:18:10,680
Speaker 1: How is one doesn't help that there's multiple JavaScript async

359
00:18:10,799 --> 00:18:15,319
methods like call there's callbacks, there's promises, there's a sync away.

360
00:18:16,440 --> 00:18:17,680
Is that all of them?

361
00:18:17,799 --> 00:18:19,680
Speaker 3: Well, if you get into some of the frameworks like

362
00:18:19,759 --> 00:18:23,200
our XGS, and you have the entire observable game as well.

363
00:18:22,960 --> 00:18:26,359
Speaker 2: React right, yeah, yeah, then is what the other frames

364
00:18:26,440 --> 00:18:28,160
will provide you on top of everything else.

365
00:18:28,680 --> 00:18:31,640
Speaker 3: And then there's a handful of listeners too, which I

366
00:18:31,680 --> 00:18:33,839
think are just callbacks if I remember, well.

367
00:18:34,119 --> 00:18:36,559
Speaker 1: How does one do a resilient strategy like we do

368
00:18:36,640 --> 00:18:40,880
with poly in c sharp, Like you know, if if

369
00:18:40,880 --> 00:18:43,400
a service is down and you call it, how can

370
00:18:43,440 --> 00:18:48,720
you do like easing, you know, back off multiple retries

371
00:18:48,799 --> 00:18:51,319
that kind of thing. Is there such a thing like

372
00:18:51,359 --> 00:18:52,960
that built into JavaScript?

373
00:18:53,960 --> 00:18:57,839
Speaker 3: So our XGS does have a if you're dealing with observables,

374
00:18:57,839 --> 00:19:01,359
does have a retry function. But you can fairly easily

375
00:19:01,440 --> 00:19:04,720
do or retribe, because what you're gonna you're gonna utilize

376
00:19:04,720 --> 00:19:06,839
your catch for that, right, So we're either going to

377
00:19:06,920 --> 00:19:09,559
do in a trycatch block or as a dot catch

378
00:19:09,799 --> 00:19:11,920
you're gonna say, you're going to have a variable outside

379
00:19:11,920 --> 00:19:14,359
of that how many times have I retried? And then

380
00:19:14,400 --> 00:19:17,039
you can call itself again and increment your retry.

381
00:19:17,440 --> 00:19:17,640
Speaker 4: Right.

382
00:19:18,519 --> 00:19:20,880
Speaker 3: The other thing you can do in your catch is say, okay,

383
00:19:20,960 --> 00:19:24,559
this one's down, give me a different one. There's promise

384
00:19:24,640 --> 00:19:26,960
not all settled that you can use. So if you

385
00:19:27,079 --> 00:19:30,200
have like say, three three different APIs that you want

386
00:19:30,240 --> 00:19:32,720
to hit, but you know that one of them is

387
00:19:32,839 --> 00:19:35,720
likely to fail. But if you can get the data, great,

388
00:19:35,839 --> 00:19:39,759
If not, we'll move on, it's okay, situation. Or if

389
00:19:39,799 --> 00:19:42,039
you want to handle depending on let's say you've got

390
00:19:42,079 --> 00:19:44,039
your three calls, but you want to handle your failures

391
00:19:44,039 --> 00:19:46,720
a little bit differently, you can do and all settled.

392
00:19:46,759 --> 00:19:49,519
So what happens with the all settled is like, let's

393
00:19:49,519 --> 00:19:52,279
say one of your three of them dies in the middle, right,

394
00:19:52,519 --> 00:19:55,559
Unlike the promise at all, which goes ahead and and

395
00:19:55,720 --> 00:19:58,279
will throw an error if any of them fail. What

396
00:19:58,359 --> 00:20:01,440
they all settled does is it will return for all

397
00:20:01,519 --> 00:20:06,240
three a status of either okay or there's been an error,

398
00:20:06,279 --> 00:20:08,519
and then if there's an error reason so you can

399
00:20:08,599 --> 00:20:10,799
get you can still get your data for say like

400
00:20:10,839 --> 00:20:13,359
one in two and then you'll get your error for three.

401
00:20:13,720 --> 00:20:15,799
But then you have to make sure in your once

402
00:20:15,799 --> 00:20:17,559
you get the data that you realize that it's not

403
00:20:17,599 --> 00:20:20,359
just the raw data. It's got like the value and

404
00:20:20,920 --> 00:20:23,599
the status or the value or the status in error

405
00:20:23,599 --> 00:20:26,039
depending on So you've got to remap that to whatever

406
00:20:26,079 --> 00:20:29,200
you need. But that one's convenient if you have a

407
00:20:29,279 --> 00:20:32,240
service that you know is maybe a little flaky, that

408
00:20:32,400 --> 00:20:34,559
might but you still want to do whatever you're going

409
00:20:34,599 --> 00:20:36,839
to do with the rest of the data, or if

410
00:20:36,839 --> 00:20:40,039
you're okay with only partial information. That's one that's that's

411
00:20:40,119 --> 00:20:41,079
pretty useful for that.

412
00:20:41,440 --> 00:20:42,799
Speaker 1: Yeah, yeah, you were talking about this.

413
00:20:42,880 --> 00:20:46,000
Speaker 2: Some of these more advanced features in jabscript promises like

414
00:20:46,119 --> 00:20:48,759
all settled that this is where you get some power.

415
00:20:49,039 --> 00:20:52,000
Speaker 3: Yeah. The other one if you know you've got that's

416
00:20:52,039 --> 00:20:55,359
that's part that I find particularly powerful. The only use

417
00:20:55,400 --> 00:20:58,799
case I've ever really seen it used for networking type

418
00:20:58,839 --> 00:21:03,680
of stuff, but is the race and where it's like

419
00:21:04,000 --> 00:21:06,240
you just want the first one that can get me

420
00:21:06,279 --> 00:21:09,079
an answer, get me that one nice. So you can

421
00:21:09,240 --> 00:21:12,279
put like, let's say one, two, and three in there,

422
00:21:12,400 --> 00:21:14,400
and once one of them fires, you're good. You've got

423
00:21:14,440 --> 00:21:16,599
an answer. You run with it, right, and it's going

424
00:21:16,640 --> 00:21:18,640
to give up on the other two, right, So from

425
00:21:18,640 --> 00:21:20,599
a speed perspective, that's super nice.

426
00:21:20,640 --> 00:21:22,119
Speaker 2: Whether they come back or not, you're just going to

427
00:21:22,200 --> 00:21:26,200
ignore the results, right. So, yeah, you've got multiple services

428
00:21:26,240 --> 00:21:27,880
that can bring you the result. You just want the

429
00:21:27,920 --> 00:21:28,640
fastest one.

430
00:21:28,720 --> 00:21:32,200
Speaker 3: Yeah, Now, raise will if one of them fails, it

431
00:21:32,240 --> 00:21:34,200
will fail out the same way as promised at all.

432
00:21:34,799 --> 00:21:37,160
If you do promise that any it will try until

433
00:21:37,160 --> 00:21:39,559
it gets an answer, it will give you the fastest

434
00:21:39,559 --> 00:21:42,200
answer that hasn't failed, and it won't fail until all

435
00:21:42,240 --> 00:21:44,519
of them has failed. So if you really want, just

436
00:21:44,799 --> 00:21:48,200
give me whatever as fast as humanly possible, ignore all

437
00:21:48,240 --> 00:21:52,039
failures unless everything fails, obviously, but it's promised that any

438
00:21:52,319 --> 00:21:55,200
which is kind of really powerful. I have not found

439
00:21:55,240 --> 00:21:58,240
a use case for that one yet, but one day,

440
00:21:58,440 --> 00:21:59,200
one day, I.

441
00:21:59,119 --> 00:22:03,319
Speaker 2: Will literally are you know, calling three different services from

442
00:22:03,319 --> 00:22:05,680
three different places that are going to provide the same result,

443
00:22:06,119 --> 00:22:07,640
and any of them will do.

444
00:22:07,680 --> 00:22:09,000
Speaker 1: And I don't care if any of them fail as

445
00:22:09,039 --> 00:22:11,559
long as one of them doesn't, right, sure exactly. Yeah,

446
00:22:11,559 --> 00:22:14,319
it's nice. Yeah, that is powerful. It's powerful and a

447
00:22:14,319 --> 00:22:16,559
bit weird, but you know, well strange. I mean, I'm

448
00:22:16,559 --> 00:22:19,440
thinking about the alternatives. The alternative is using sort of

449
00:22:19,519 --> 00:22:22,759
round robin dns. You know, if you've got like three

450
00:22:22,799 --> 00:22:25,480
services that are all trying to share the load or whatever.

451
00:22:25,559 --> 00:22:27,559
But what you're doing is you're hitting all three of

452
00:22:27,640 --> 00:22:30,000
them all at the same time rather than a round robin,

453
00:22:30,119 --> 00:22:33,039
So may put a little more load on the network,

454
00:22:33,119 --> 00:22:35,920
but you at least get the result that you want.

455
00:22:36,200 --> 00:22:36,359
Speaker 4: You know.

456
00:22:36,559 --> 00:22:39,839
Speaker 1: Yeah, first, first person to give me a chicken sandwich,

457
00:22:40,359 --> 00:22:40,920
I'll eat it.

458
00:22:41,119 --> 00:22:43,480
Speaker 3: The other actually, the one of the US because I

459
00:22:43,480 --> 00:22:45,799
could think for that would be if you're calling something

460
00:22:45,839 --> 00:22:48,519
like from a CDN, so you could call multiple CDMs

461
00:22:48,519 --> 00:22:51,039
so that if one of them is down right.

462
00:22:50,960 --> 00:22:54,759
Speaker 2: Yeah, yeah, sure you do want that any sense, because

463
00:22:54,759 --> 00:22:56,319
I don't care if there's a failure as long as

464
00:22:56,319 --> 00:22:56,960
there's one that.

465
00:22:56,920 --> 00:22:58,480
Speaker 3: Doesn't fail, right exactly.

466
00:22:58,839 --> 00:23:01,480
Speaker 1: Yeah, that's what's important. But you do have to throw

467
00:23:01,519 --> 00:23:03,759
the other two chicken sandwiches away, I mean, there isn't

468
00:23:04,000 --> 00:23:04,839
if they if you're.

469
00:23:04,680 --> 00:23:09,000
Speaker 3: Goin of like, well it would I'd have to double

470
00:23:09,119 --> 00:23:11,640
check the network. But the network calls from the browser,

471
00:23:11,680 --> 00:23:13,839
but I think it actually abandons the network call, like

472
00:23:13,920 --> 00:23:15,599
it terminates.

473
00:23:15,200 --> 00:23:17,839
Speaker 1: If it always drops the connection. Well, that's good.

474
00:23:17,839 --> 00:23:20,440
Speaker 3: I think I'd have to double check that, and it

475
00:23:20,559 --> 00:23:23,680
might that might even be browser specific, so that that

476
00:23:23,720 --> 00:23:26,000
would be don't quote me on that one, because I'd

477
00:23:26,000 --> 00:23:26,759
have to actually.

478
00:23:26,519 --> 00:23:28,759
Speaker 1: Look at that, But that would be smart. That would be,

479
00:23:29,200 --> 00:23:30,640
you know, in a perfect world.

480
00:23:30,480 --> 00:23:33,559
Speaker 3: In a perfect world. Yeah, because the Internet is perfect,

481
00:23:33,559 --> 00:23:37,640
it has yeah never never, and JavaScript is perfect, it

482
00:23:37,640 --> 00:23:38,680
has no flaws.

483
00:23:38,960 --> 00:23:41,400
Speaker 1: It's the best language ever.

484
00:23:42,200 --> 00:23:46,079
Speaker 3: It was totally thought through when it was created, right.

485
00:23:45,920 --> 00:23:49,519
Speaker 1: Oh, definitely. I think it took a weekend, right, So

486
00:23:50,559 --> 00:23:56,200
let's yeah, Well, let's talk about some challenges when approaching

487
00:23:57,000 --> 00:24:02,200
acink JavaScript programming for the first time. What are people

488
00:24:02,359 --> 00:24:03,720
getting hung up on?

489
00:24:04,319 --> 00:24:07,079
Speaker 3: One of the common one of the common things I've

490
00:24:07,119 --> 00:24:11,759
seen when I'm teaching people how to use promises is

491
00:24:12,400 --> 00:24:14,880
they'll learn a pattern and they'll try to use it everywhere,

492
00:24:14,880 --> 00:24:16,960
no matter what. And I don't think this is specific

493
00:24:17,039 --> 00:24:17,839
to promises.

494
00:24:18,240 --> 00:24:22,519
Speaker 1: Here's your hammer, find the nails exactly.

495
00:24:22,200 --> 00:24:22,960
Speaker 4: They'll learn I go.

496
00:24:23,039 --> 00:24:25,440
Speaker 3: Let's say they'll learn a sink await right, and they

497
00:24:25,480 --> 00:24:28,480
will regardless of whether it needs to be parallel or not.

498
00:24:28,960 --> 00:24:32,720
They'll just like await everything right. And so I mean,

499
00:24:32,759 --> 00:24:35,839
in the end it works, and this is the piece. Right,

500
00:24:35,839 --> 00:24:37,839
in the end, it works if even if you need

501
00:24:37,880 --> 00:24:40,559
it technically to have them in parallel, you await everything

502
00:24:41,079 --> 00:24:44,799
you you're gonna you're gonna take a performance hit, but

503
00:24:44,880 --> 00:24:48,599
it'll work. Right. So I think those are the most

504
00:24:48,839 --> 00:24:52,000
probably nefarious things because it's.

505
00:24:51,839 --> 00:24:54,799
Speaker 1: Not like it's broken, and we have the same problems

506
00:24:54,880 --> 00:24:57,839
sea sharp Right. Once you learn a sync awight, you

507
00:24:57,880 --> 00:25:01,160
want to do everything a sink and don't necessarily need

508
00:25:01,200 --> 00:25:05,359
to a perfect example of this is data access right.

509
00:25:06,359 --> 00:25:10,279
Data access can be completely done with adeo dot net,

510
00:25:10,359 --> 00:25:12,799
which is sort of the lingua franca of dot net,

511
00:25:14,200 --> 00:25:19,319
sql access or whatever, and it can all be done synchronously,

512
00:25:19,359 --> 00:25:21,880
and it should be done synchronously because there isn't any

513
00:25:21,880 --> 00:25:27,319
reason not to. When you add a sync to it,

514
00:25:27,480 --> 00:25:30,759
even though you're not using it now, you're requiring the

515
00:25:30,799 --> 00:25:33,680
method that calls it to be a sync. So property

516
00:25:33,720 --> 00:25:39,079
getters and setters become more difficult, you know, just standard

517
00:25:39,079 --> 00:25:41,440
events that aren't marked a sync that you don't want

518
00:25:41,440 --> 00:25:44,039
to mark a sync that kind of stuff. So, yeah,

519
00:25:44,079 --> 00:25:45,400
we have the same problem over here.

520
00:25:45,559 --> 00:25:49,359
Speaker 3: The other one I see, which is again is a

521
00:25:49,359 --> 00:25:52,000
little bit more advanced, but it's the trying to mix

522
00:25:52,079 --> 00:25:55,039
and match two things and make them work well together.

523
00:25:55,200 --> 00:26:00,000
So like not realizing that you can fairly easily transform

524
00:26:00,119 --> 00:26:02,960
a call back into a promise and then trying to

525
00:26:03,079 --> 00:26:05,720
mix your callbacks and your promises and ending up in

526
00:26:05,799 --> 00:26:10,240
some weird, kind of weird Christmas tree jumbold mess because

527
00:26:10,279 --> 00:26:14,279
you're trying to mix the two or same with So

528
00:26:14,720 --> 00:26:18,839
if you're using RXGS and you're using observables in an

529
00:26:18,920 --> 00:26:22,200
RXGS chain, so let's say you have your first you know,

530
00:26:22,240 --> 00:26:25,000
you get your your calling, your observable you get, and

531
00:26:25,000 --> 00:26:27,319
then you're going to do a pipe with your maps

532
00:26:27,319 --> 00:26:30,079
and your switch maps and your all of those things.

533
00:26:30,279 --> 00:26:32,880
You can actually return as part of a switch map

534
00:26:32,920 --> 00:26:35,880
a promise instead of an observable, and it'll take it

535
00:26:35,960 --> 00:26:38,920
like a champion on the output return and observable. So

536
00:26:39,319 --> 00:26:41,440
that's kind of but what I see is people not

537
00:26:41,519 --> 00:26:44,920
realizing that they can do that and that that promise

538
00:26:45,200 --> 00:26:49,279
as long as you're starting with an observable in RXGS,

539
00:26:49,319 --> 00:26:51,559
you can stick and promise in the middle or call

540
00:26:51,640 --> 00:26:54,000
that's actually to a promise in the middle, and it's fine,

541
00:26:54,079 --> 00:26:57,319
and it'll take it. I mean, you're going to get

542
00:26:57,359 --> 00:27:00,440
a one time value. It's not going to be a stream,

543
00:27:00,480 --> 00:27:04,039
but it'll it'll work. And so I see some weirdnesses

544
00:27:04,039 --> 00:27:08,480
in trying to like shoehorn in various often very creative

545
00:27:08,480 --> 00:27:13,680
ways the pieces together with not not quite understanding where

546
00:27:13,680 --> 00:27:16,720
they line up and how you can either turn one

547
00:27:16,759 --> 00:27:20,920
into the other or where chaining can just work and

548
00:27:20,960 --> 00:27:23,519
doesn't have to. And the other big one is like

549
00:27:23,559 --> 00:27:26,039
the Christmas train I talked about before, or instead of

550
00:27:26,160 --> 00:27:28,480
dot venning as a chain, they just kind of start

551
00:27:28,599 --> 00:27:31,759
nesting the dot bens forever and ever amen, which again

552
00:27:31,920 --> 00:27:34,559
works but not ideal and hard to read.

553
00:27:34,720 --> 00:27:37,680
Speaker 1: Right right, did you say forever and ever amen? Yes,

554
00:27:38,599 --> 00:27:41,400
Hodding Randy Travis, there, I saw what you did there.

555
00:27:41,519 --> 00:27:44,039
All right, let's take a break and when we get back,

556
00:27:44,079 --> 00:27:46,039
we got some more questions from our tin doubt and

557
00:27:46,079 --> 00:27:49,559
we'll be right back. Don't go away. Did you know

558
00:27:49,599 --> 00:27:53,000
you can easily migrate asp net web apps to Windows

559
00:27:53,039 --> 00:27:57,480
containers on aws. Use the app to container tool to

560
00:27:57,599 --> 00:28:02,440
containerize your iis websites and deploy to aws Managed Container

561
00:28:02,519 --> 00:28:07,119
services with or without Kubernetes. Find out more about app

562
00:28:07,160 --> 00:28:11,839
to container at aws dot Amazon dot com, Slash dot net,

563
00:28:12,039 --> 00:28:19,079
slash modernize, and we're back. It's dot net rock some

564
00:28:19,240 --> 00:28:22,079
Carl Franklin. That's my friend Richard Campbell. Hey there, Martin

565
00:28:22,200 --> 00:28:26,519
dubtny is here. We're talking javascripts and let's see if

566
00:28:26,519 --> 00:28:28,319
you don't want ads. By the way, if you don't

567
00:28:28,359 --> 00:28:30,839
want to hear these breakads, you can become a patron

568
00:28:30,920 --> 00:28:33,160
at Patreon dot dot Nerocks dot com five bucks a

569
00:28:33,160 --> 00:28:35,839
month and we'll give you an ad free feed. Uh okay, Richard,

570
00:28:35,839 --> 00:28:37,519
you had a question, then I want to I have

571
00:28:37,599 --> 00:28:40,440
a question to change course. Yeah, well, just before the

572
00:28:40,480 --> 00:28:43,359
break Martine should have just dropped RxJS in our laps.

573
00:28:43,400 --> 00:28:44,559
I'm like, wait what yeah?

574
00:28:45,319 --> 00:28:47,599
Speaker 2: Uh, Because I always thought that the reactive extensions were

575
00:28:47,640 --> 00:28:51,519
important before promises had been standardizing the browsers, like reactive

576
00:28:51,559 --> 00:28:54,680
js came along like twenty fifteen, twenty sixteen, and we

577
00:28:54,720 --> 00:28:58,920
didn't get uniformity on promises to like twenty twenty one,

578
00:29:01,039 --> 00:29:03,799
so it seemed like rxchas's a safe way to go.

579
00:29:03,759 --> 00:29:08,200
Speaker 3: Right, it's fairly recently. Yeah, well they have very different purposes,

580
00:29:08,519 --> 00:29:12,799
So okay, like, can you do similar that you? So,

581
00:29:13,480 --> 00:29:16,960
let me back up with rxs and the concept of observables,

582
00:29:17,200 --> 00:29:21,759
assuming it's not an and and I think observable, which

583
00:29:21,799 --> 00:29:24,200
is a whole different ballgame. Let's let's muddel the two

584
00:29:24,240 --> 00:29:27,160
while we're at it, because of course we can't but

585
00:29:28,200 --> 00:29:32,319
an observable, whether it's just a dumb subject, a behavior subject,

586
00:29:32,440 --> 00:29:35,359
or a replace subject, is going to be a stream, right.

587
00:29:35,720 --> 00:29:39,119
Promises are one and done. So the fact that you

588
00:29:39,119 --> 00:29:41,039
can mix and match the two and the fact that

589
00:29:41,079 --> 00:29:44,160
you can kind of make both of them work together

590
00:29:44,680 --> 00:29:48,240
is a nice city. But they have a very different

591
00:29:49,480 --> 00:29:52,079
purposes in the grand scheme of things, Like if I

592
00:29:52,160 --> 00:29:55,160
want to continue listening to something, I can't use it.

593
00:29:55,400 --> 00:29:58,480
I mean, I can do things with promises, but like

594
00:29:58,559 --> 00:30:02,400
I still have to have my listener versus the observable

595
00:30:02,480 --> 00:30:05,319
with Once you subscribe to the observable, you're going to

596
00:30:05,400 --> 00:30:09,279
get that stream until you unsubscribe. Of course, because everything

597
00:30:09,400 --> 00:30:12,240
JavaScript has to be complicated, We're going to add the

598
00:30:12,279 --> 00:30:15,000
async subject in the mix, which is a one and done,

599
00:30:15,039 --> 00:30:17,440
which is an observable you subscribe to as if it

600
00:30:17,559 --> 00:30:21,359
was any other of the observable types, which but it's

601
00:30:21,400 --> 00:30:24,559
not going to fire off the result until it's completed,

602
00:30:24,640 --> 00:30:26,359
so it'll only ever have that one value.

603
00:30:26,440 --> 00:30:28,759
Speaker 1: The way I think of reactive extensions is a way

604
00:30:28,799 --> 00:30:32,799
to turn event handling in the classic sense, where you

605
00:30:32,839 --> 00:30:34,960
have event listeners and you do something in the event

606
00:30:35,000 --> 00:30:37,480
handler and just turn that into like you said, a

607
00:30:37,559 --> 00:30:40,359
stream or something that you can query, hey, how many

608
00:30:40,359 --> 00:30:42,920
times did this event occur? And quantify that and give

609
00:30:42,920 --> 00:30:46,000
me the data that was passed in. And that came

610
00:30:46,160 --> 00:30:49,759
really into sharp focus when we interviewed remember Bjorn and

611
00:30:49,799 --> 00:30:55,480
the guys that did the helicopter whatever the drone programs

612
00:30:56,039 --> 00:31:00,359
at NDC, and they wrote a little tool to handle

613
00:31:00,759 --> 00:31:02,960
those because there's a lot of events that come right

614
00:31:03,000 --> 00:31:06,160
when they when they're flying around and they're moving, and

615
00:31:06,720 --> 00:31:11,160
they use the reactive extensions to to manage that, which

616
00:31:11,200 --> 00:31:14,720
would be absolutely impossible trying to do it with event handlers,

617
00:31:15,240 --> 00:31:19,000
timers and things. So anyway, that's that's my understanding of

618
00:31:19,880 --> 00:31:22,519
the reactive kind of observable model.

619
00:31:22,559 --> 00:31:26,640
Speaker 3: The I think the most the most. There's kind of

620
00:31:26,680 --> 00:31:30,039
two places I use it a lot. I'm from going

621
00:31:30,079 --> 00:31:32,799
to use observables. I would say one of them is

622
00:31:32,799 --> 00:31:34,640
I do tend to work a lot with Firebase and

623
00:31:34,680 --> 00:31:38,319
Firebase as a real time database and the fire store.

624
00:31:38,359 --> 00:31:40,720
But either way it's it's a real time situation, right,

625
00:31:40,799 --> 00:31:44,960
So I can subscribe to my data, and as data

626
00:31:45,039 --> 00:31:47,319
changes in the database, I'm just going to get the

627
00:31:47,400 --> 00:31:50,640
latest and greatest directly so to me using this, you know,

628
00:31:50,839 --> 00:31:54,160
using the their system. So that's one of the ways

629
00:31:54,160 --> 00:31:57,359
where it's legitimately a stream that I'm you know, connected

630
00:31:57,359 --> 00:32:00,480
to my database directly and I want to get that

631
00:32:00,519 --> 00:32:02,400
stream now. Where that gets interesting, and then you have

632
00:32:02,440 --> 00:32:04,440
to worry about, Okay, I'm piping this to a form

633
00:32:04,759 --> 00:32:07,559
I maybe don't want my form values to go ahead

634
00:32:07,599 --> 00:32:10,000
and update just because somebody else updated the data day.

635
00:32:10,079 --> 00:32:12,720
So there's use cases where you have to start thinking, okay,

636
00:32:12,759 --> 00:32:15,279
where do I want it feeding me the stream or

637
00:32:15,319 --> 00:32:17,960
where do I want it to get the stream? Call

638
00:32:18,000 --> 00:32:20,759
it a one and done, and you know there's there's

639
00:32:20,839 --> 00:32:25,400
months is there. And the other piece is let's say

640
00:32:25,400 --> 00:32:28,400
I have a piece of data in a service, right

641
00:32:28,440 --> 00:32:30,160
that I'm keeping up to date so that I can

642
00:32:30,200 --> 00:32:34,599
potentially send to multiple components or multiple places in might UI, right,

643
00:32:34,720 --> 00:32:37,400
and it might be something local too. I don't know,

644
00:32:37,799 --> 00:32:41,480
let's say it's a let's do the number of visitor

645
00:32:41,519 --> 00:32:43,960
tickers something dumb, right, it doesn't matter what it is.

646
00:32:45,119 --> 00:32:47,640
And so that would be something where I can feed

647
00:32:47,720 --> 00:32:50,599
whatever the latest value is and any component Okay, I

648
00:32:50,680 --> 00:32:53,480
usually use Angular a lot, so any component would go

649
00:32:53,519 --> 00:32:56,359
ahead and you know, get that value an automatically update

650
00:32:56,400 --> 00:32:58,359
and automatically do what it needs to do in the

651
00:32:58,480 --> 00:33:01,720
UI and update the UI according or do some math

652
00:33:01,920 --> 00:33:04,440
or whatever. But those are kind of the two places.

653
00:33:04,559 --> 00:33:08,279
Is either for uy stay in terms of or maybe

654
00:33:08,319 --> 00:33:10,519
turning something off and on and being able to listen

655
00:33:10,559 --> 00:33:13,119
to an action happening anywhere and turn something off and on,

656
00:33:13,400 --> 00:33:16,319
or like dark mode is a good example that way

657
00:33:16,359 --> 00:33:20,319
doesn't matter where the button is and then or because

658
00:33:20,359 --> 00:33:23,079
then I can have the button trigger the update and

659
00:33:23,119 --> 00:33:26,279
then whatever's list switching over the theme is listening to

660
00:33:26,319 --> 00:33:30,000
that to that observable or connected to the database. But

661
00:33:30,039 --> 00:33:34,279
that's a little bit different. Then let's say your your

662
00:33:34,319 --> 00:33:36,759
promises where it's like a one and done. Once it's done,

663
00:33:36,799 --> 00:33:39,759
it's done. It's not there's no continual listening. But it

664
00:33:39,759 --> 00:33:41,680
also means that when you're dealing with the observables, you

665
00:33:41,759 --> 00:33:44,240
have to make sure to stop listening to them at

666
00:33:44,240 --> 00:33:46,720
some point, because otherwise you end up with them. Yeah,

667
00:33:46,960 --> 00:33:49,240
there's a cleanup step that now needs to happen, which

668
00:33:49,359 --> 00:33:52,680
doesn't happen in promises because obviously there were when I'm done.

669
00:33:52,759 --> 00:33:56,279
Speaker 2: Okay, so I'm preeting pretty clear on our xas is

670
00:33:56,319 --> 00:33:59,240
for observers connecting to streams and being able to react

671
00:33:59,240 --> 00:34:01,920
to them accordingly. Yeah, maybe I'm not a clear on

672
00:34:02,079 --> 00:34:05,119
where i'd use promises versus async a weight and JavaScript,

673
00:34:05,160 --> 00:34:06,960
because you know, when I look at the rafts to

674
00:34:07,039 --> 00:34:09,280
async a weight, they basically say, hey, this is making

675
00:34:09,320 --> 00:34:10,400
promises nicer.

676
00:34:10,679 --> 00:34:11,079
Speaker 1: Yeah.

677
00:34:11,119 --> 00:34:14,400
Speaker 3: So yeah, so acync await is just is just a

678
00:34:16,760 --> 00:34:21,239
uh a way to do promises. It's not changing anything.

679
00:34:21,239 --> 00:34:26,360
It's just a how do you want to think of it?

680
00:34:26,599 --> 00:34:29,280
Maybe grammar like how do you want to structure your promise?

681
00:34:29,360 --> 00:34:31,480
That's all that's all it is to It doesn't change

682
00:34:31,480 --> 00:34:33,639
anything about the functionality. It's not do I want to

683
00:34:33,719 --> 00:34:37,039
use asink or promises? It's like I'm using promises and

684
00:34:37,079 --> 00:34:40,039
do I want to write do I wanted to you know,

685
00:34:40,400 --> 00:34:42,639
write it this way or that way? Essentially, that's all.

686
00:34:42,639 --> 00:34:45,039
It's just a syntactic sugar at that point.

687
00:34:44,880 --> 00:34:47,320
Speaker 1: And you mentioned that you prefer using asnk a weight

688
00:34:47,400 --> 00:34:50,880
because you can do everything line by line rather than

689
00:34:51,000 --> 00:34:52,800
having dot the n's all over the place.

690
00:34:53,199 --> 00:34:56,239
Speaker 3: Yeah, I just it's but it's not going to be.

691
00:34:56,400 --> 00:34:57,800
It's not I'm not going to be able to write

692
00:34:57,840 --> 00:35:00,760
it that way for everything because of the wholeation we

693
00:35:00,760 --> 00:35:03,440
were talking about earlier. Right, it depends on. But if

694
00:35:03,480 --> 00:35:06,800
I'm doing very much A, then B, then C very

695
00:35:06,920 --> 00:35:09,480
programmatically one two, three, four five, then I find it

696
00:35:09,519 --> 00:35:12,559
a lot easier to to handle, especially if I really

697
00:35:12,639 --> 00:35:15,119
don't care about error handling outside of it worked or

698
00:35:15,159 --> 00:35:17,559
it failed like my function worker failed, in which case

699
00:35:17,639 --> 00:35:20,320
I track at the block and I'm done, right.

700
00:35:20,719 --> 00:35:23,199
Speaker 1: And you still have access to the ane and all

701
00:35:23,280 --> 00:35:26,519
settled and all that stuff, whether you're using the ACN

702
00:35:27,000 --> 00:35:29,320
syntax or just the promise intex Yeah.

703
00:35:29,159 --> 00:35:33,599
Speaker 3: Oh yeah, yeah, because instead of doing promise dot all,

704
00:35:33,960 --> 00:35:36,079
you know, my array of promises dot done, I would

705
00:35:36,119 --> 00:35:41,360
do my results equals away promised dot all, my array

706
00:35:41,440 --> 00:35:43,079
of promises essentially.

707
00:35:43,280 --> 00:35:45,800
Speaker 1: Right. Okay, a while ago before the break, you brought

708
00:35:45,880 --> 00:35:49,119
up map, and I'm not so sure many of our

709
00:35:49,119 --> 00:35:52,239
listeners know what that is in another one map switch

710
00:35:52,320 --> 00:35:54,239
or maple switch up.

711
00:35:55,000 --> 00:35:59,199
Speaker 3: So those are all various RXGS functions that do various things.

712
00:35:59,239 --> 00:36:02,480
So in our which is okay, so map, there's your

713
00:36:02,599 --> 00:36:05,119
XGS map and then there's map in terms of mapping

714
00:36:05,199 --> 00:36:08,480
in arrays in JavaScript, so of course reduce the same name.

715
00:36:08,519 --> 00:36:10,239
So it's great, and they do different things. It's great.

716
00:36:10,320 --> 00:36:12,800
Speaker 1: We'll be confusing at all, not at all, no.

717
00:36:12,559 --> 00:36:16,679
Speaker 3: Not at all, but no, those are just ways to

718
00:36:16,960 --> 00:36:24,079
chain in ox in our XGS in order to do

719
00:36:24,199 --> 00:36:26,519
things with the data once you subscribe, you know, once

720
00:36:26,559 --> 00:36:29,760
you're doing something with your observable, right, So map would

721
00:36:29,800 --> 00:36:33,920
allow you to just transform the data and return switch

722
00:36:34,000 --> 00:36:36,880
map allows you to call another observable or promise and

723
00:36:36,920 --> 00:36:40,559
then return that. It's just with various ways of chaining.

724
00:36:40,599 --> 00:36:44,480
And there's I don't know how many, there's at least

725
00:36:44,519 --> 00:36:48,679
twenty or so, if not more. Various ones won't bore

726
00:36:48,760 --> 00:36:51,480
you with the details, really, people can read the dogs.

727
00:36:52,239 --> 00:36:54,840
Speaker 1: But yeah, yeah, no, I think the main thing to

728
00:36:54,880 --> 00:36:57,639
know is there's a way to do this. Just go

729
00:36:57,719 --> 00:37:04,000
look at the docks. Yeah, very good. Any other gotchas

730
00:37:04,000 --> 00:37:08,280
that people find when they're starting the ACENC got down

731
00:37:08,320 --> 00:37:09,039
the ACENC path.

732
00:37:09,119 --> 00:37:13,239
Speaker 3: I'd say where to put your catches, like where where,

733
00:37:13,280 --> 00:37:17,239
and how to catch your errors, like because you can

734
00:37:17,599 --> 00:37:21,400
say await my promise, dot catch and then return a

735
00:37:21,440 --> 00:37:24,400
different value if it fails in a series of your

736
00:37:24,440 --> 00:37:26,400
asinka weights and then still put it in a try

737
00:37:26,440 --> 00:37:29,159
catch block, which so means that if anything else in

738
00:37:29,199 --> 00:37:31,599
your function fails, then it would just go ahead and catch.

739
00:37:31,840 --> 00:37:34,760
So I would say, think through where your catches are

740
00:37:34,840 --> 00:37:37,039
and what they affect, so that you can know how

741
00:37:37,079 --> 00:37:40,960
and where you're handling your errors, because you can't actually

742
00:37:41,000 --> 00:37:44,519
do put a dot catch something dot catch inside of

743
00:37:44,519 --> 00:37:46,760
a try catch block and then figure out where your

744
00:37:46,840 --> 00:37:49,719
is being caught and by what and how right and

745
00:37:49,760 --> 00:37:53,280
the fact that a trycatch block the catch doesn't return

746
00:37:53,320 --> 00:37:57,000
a value. However, a dot if you do my promise

747
00:37:57,559 --> 00:38:00,519
doc you know, fetch my url whatever, dot catch, so

748
00:38:00,719 --> 00:38:04,199
my promise dot catch, you can actually take the air

749
00:38:04,280 --> 00:38:06,280
or swallow the air and return it if a value

750
00:38:06,320 --> 00:38:09,679
should at sale. So you could potentially have something where

751
00:38:09,960 --> 00:38:11,719
if you can't get a value, you're going to return

752
00:38:11,800 --> 00:38:16,800
some defult object. Right, you could totally do that or no, yeah,

753
00:38:17,119 --> 00:38:18,840
but then what do you do with that air? Or

754
00:38:18,880 --> 00:38:21,079
do you just swallow it and never know what happened?

755
00:38:21,119 --> 00:38:23,559
Do you send it somewhere for air handling? What do

756
00:38:23,639 --> 00:38:26,480
you like if you're going to swallow it, what are

757
00:38:26,519 --> 00:38:28,760
you going to how do you want to handle that

758
00:38:28,800 --> 00:38:30,639
in terms of you knowing it happened or do you

759
00:38:30,679 --> 00:38:31,159
even care?

760
00:38:31,599 --> 00:38:35,360
Speaker 1: Right? So it's like, as long as something got returned, right, if.

761
00:38:35,679 --> 00:38:39,000
Speaker 3: My dude entered his wrong password, I don't really care

762
00:38:39,039 --> 00:38:40,639
to send that to my server.

763
00:38:40,679 --> 00:38:44,039
Speaker 1: You know, right, Like yeah, and c sharp reez that

764
00:38:44,519 --> 00:38:49,320
catch handlers for logging primarily and transforming whatever data is

765
00:38:49,360 --> 00:38:51,519
going to be returned if it's in a method. Right,

766
00:38:51,559 --> 00:38:54,039
If you have a method, you put the whole thing

767
00:38:54,039 --> 00:38:56,559
in a try, but you put the return value up

768
00:38:56,599 --> 00:39:00,239
the top before the try, and then modify it if

769
00:39:00,239 --> 00:39:03,320
everything is fine and it's not all I fits if

770
00:39:03,320 --> 00:39:05,960
you get an exception and return it at the bottom

771
00:39:05,960 --> 00:39:08,599
no matter what, or in a finally. But you know,

772
00:39:08,639 --> 00:39:11,559
that's just a pattern that I use a lot. I've

773
00:39:11,599 --> 00:39:16,800
seen it abused. I've seen try catches nested within catches

774
00:39:17,599 --> 00:39:18,280
for example.

775
00:39:18,440 --> 00:39:21,400
Speaker 3: Yep, I've seen those two not good. I've seen those

776
00:39:22,079 --> 00:39:22,599
good or.

777
00:39:22,639 --> 00:39:25,199
Speaker 1: Hidden dependencies where every time you tested it, it loaded in

778
00:39:25,239 --> 00:39:28,119
a particular order, so you never realize that actually it

779
00:39:28,159 --> 00:39:30,239
had an order dependency that you weren't protecting yourself from.

780
00:39:30,320 --> 00:39:32,199
Oh no, yeah, it's terrible. Yeah.

781
00:39:32,320 --> 00:39:35,239
Speaker 3: Race conditions are fun too, when you've forgotten away somewhere,

782
00:39:35,559 --> 00:39:36,480
oh right, or.

783
00:39:36,440 --> 00:39:38,679
Speaker 1: You forgot yeah, oh yeah, that's right.

784
00:39:39,159 --> 00:39:42,320
Speaker 3: We do have finally as well. On javascripts we do

785
00:39:42,400 --> 00:39:44,679
have finally as well. But finally in an observable one,

786
00:39:44,719 --> 00:39:46,679
finally and I promise don't work the same, because of

787
00:39:46,719 --> 00:39:51,639
course they don't. Course not, what do you want they

788
00:39:51,760 --> 00:39:54,559
do when they they do when they don't. So finally

789
00:39:54,599 --> 00:39:57,320
in a promise does exactly what you think it's going

790
00:39:57,400 --> 00:39:59,599
to trigger, whether you've succeeded or failed.

791
00:40:00,159 --> 00:40:00,360
Speaker 1: Right.

792
00:40:00,440 --> 00:40:04,480
Speaker 3: Finally, in a stream will only hit when the stream completes,

793
00:40:04,880 --> 00:40:09,880
so it's not after every successful value. Once the stream completes,

794
00:40:09,920 --> 00:40:13,519
that means you've closed off, or you've said dot complete

795
00:40:13,760 --> 00:40:18,159
or you've shut that down. Well that's once the stream complete. So,

796
00:40:18,400 --> 00:40:20,519
but it's worth noting the difference that it's not going

797
00:40:20,559 --> 00:40:22,199
to be every time you get a value.

798
00:40:22,440 --> 00:40:24,840
Speaker 2: Right, this is back to that stream versus one and

799
00:40:24,920 --> 00:40:29,719
done mindset right, correct, It actually is the same. It

800
00:40:29,760 --> 00:40:32,159
is actually I responded the same event it's the closing

801
00:40:32,320 --> 00:40:35,159
of the socket that raises the event. It's just that

802
00:40:35,400 --> 00:40:38,239
in an observable, it doesn't close to you complete exactly.

803
00:40:38,440 --> 00:40:41,000
Speaker 1: Can I just make an observation? What's really amazing to me?

804
00:40:41,679 --> 00:40:46,280
We've been doing this show for how in years? Twenty

805
00:40:46,480 --> 00:40:49,760
three something like that, all right, and you've been there

806
00:40:49,760 --> 00:40:51,679
for most of them, Richard, So don't say you're the

807
00:40:51,760 --> 00:40:55,159
new kid. But when I started it, I said, we

808
00:40:55,239 --> 00:40:59,960
are never going to read code on this show, right, right,

809
00:41:00,079 --> 00:41:05,039
But we're getting very close with this. We are well,

810
00:41:05,119 --> 00:41:08,719
and I think we've been close before. I'm following it,

811
00:41:08,760 --> 00:41:11,519
and I'm thinking that a lot of people are following

812
00:41:11,559 --> 00:41:12,400
it too. Yeah, I know.

813
00:41:12,599 --> 00:41:14,760
Speaker 2: I appreciate that. I've never had this clearer in my

814
00:41:14,800 --> 00:41:15,800
head than right now.

815
00:41:16,000 --> 00:41:17,880
Speaker 1: Yeah, right that. This is why I wanted to call

816
00:41:17,920 --> 00:41:20,280
Martine in the first place. It's like, oh good, if

817
00:41:20,280 --> 00:41:22,639
she's explaining it, I'll probably understand it.

818
00:41:23,039 --> 00:41:25,920
Speaker 2: So yes, now, now you see all the roles for

819
00:41:25,960 --> 00:41:29,199
each of these pieces, So that's good. It just makes

820
00:41:29,199 --> 00:41:32,079
sense to where and why you would use this but

821
00:41:32,159 --> 00:41:34,239
don't use it everywhere all the time. Why is that

822
00:41:35,239 --> 00:41:35,760
just complex?

823
00:41:35,800 --> 00:41:39,119
Speaker 3: Well, I don't know. You know, if you have a

824
00:41:39,119 --> 00:41:40,079
hammer might as well.

825
00:41:40,199 --> 00:41:42,760
Speaker 1: No, here's a hammer.

826
00:41:43,559 --> 00:41:46,960
Speaker 3: Yeah, I can CSS important everything. It'll be fine.

827
00:41:47,480 --> 00:41:54,480
Speaker 1: No, I can't believe you said that. That's something i'd say.

828
00:41:54,840 --> 00:41:56,320
Speaker 3: I have to make fun of it. I have to

829
00:41:56,320 --> 00:41:57,880
make fun of my own world a little bit.

830
00:41:58,360 --> 00:42:01,880
Speaker 2: Sure, I appreciate that, and we all do that, but

831
00:42:02,119 --> 00:42:05,559
I do feel like it introduces complexity, and it's only

832
00:42:05,639 --> 00:42:08,360
if you need it you should be asynchronous. That this

833
00:42:08,639 --> 00:42:11,840
does delay the rendering of a page. This isn't essential

834
00:42:11,880 --> 00:42:14,320
for people being able to do their work. Oh yeah,

835
00:42:14,719 --> 00:42:16,440
I really like a web page.

836
00:42:16,440 --> 00:42:19,679
Speaker 1: I've that's crafted in a way where I'm still able

837
00:42:19,679 --> 00:42:21,239
to click on what I need because I knew where

838
00:42:21,280 --> 00:42:23,000
it was before the page was even finished loading. And

839
00:42:23,039 --> 00:42:26,039
it'll continue. It's fine. And an ACYNC tolerates that.

840
00:42:26,280 --> 00:42:29,320
Speaker 3: Yeah, And that actually has more to do with how

841
00:42:29,360 --> 00:42:33,280
the JavaScript is loaded into the I mean there's two

842
00:42:33,320 --> 00:42:35,639
aspects to that. There's one, how are you loading that

843
00:42:35,760 --> 00:42:39,039
JavaScript while into the browser? Right, because you you might

844
00:42:39,079 --> 00:42:42,119
have browser you might have JavaScript that's needed immediately on

845
00:42:42,199 --> 00:42:45,239
the page load, versus you can get there when it

846
00:42:45,320 --> 00:42:49,599
gets there and then you can the actual the If

847
00:42:49,599 --> 00:42:53,280
you're doing dumb HTML, you've got the source on the

848
00:42:53,320 --> 00:42:55,400
source attribute. You can go ahead and put an acinc

849
00:42:55,440 --> 00:42:59,440
decorator and go ahead and make that, I think. But

850
00:43:00,199 --> 00:43:03,079
so that's part number one, and then part number two

851
00:43:03,199 --> 00:43:06,440
is how did you structure your HTML and what not

852
00:43:06,599 --> 00:43:09,960
to render based on when? When things load right? And

853
00:43:10,000 --> 00:43:12,280
what data do you need to load? Wet But there's

854
00:43:12,320 --> 00:43:15,079
two there's two aspects to that, which is also how

855
00:43:15,199 --> 00:43:18,920
is this JavaScript itself being loaded into the browser that

856
00:43:18,960 --> 00:43:21,119
may or may not block the rendering of the browser.

857
00:43:21,159 --> 00:43:23,320
And now you're getting into the whole core web vitals

858
00:43:23,320 --> 00:43:24,880
thing and all that fun stuff.

859
00:43:24,920 --> 00:43:27,599
Speaker 1: But yeah, just because I'm too impatient away for a

860
00:43:27,599 --> 00:43:30,119
whole patient render. You know, a lot of these rules

861
00:43:30,159 --> 00:43:33,440
that Martine is talking about also apply in Blazer programming. Yeah,

862
00:43:33,440 --> 00:43:36,960
I mean it's basically web programming, you know, in web

863
00:43:37,039 --> 00:43:39,360
is web. So that's a good if any of the

864
00:43:39,400 --> 00:43:42,840
Blazer programmers listening too. It's a good rule to only

865
00:43:42,920 --> 00:43:45,719
use a sink when you need a sinc. Very good rule. Yeah,

866
00:43:45,960 --> 00:43:48,639
your environment's still the same, it's just the coding language chain,

867
00:43:48,679 --> 00:43:52,039
that's right, because it presumably the user's needs are the same,

868
00:43:52,159 --> 00:43:53,440
like users.

869
00:43:53,159 --> 00:43:58,039
Speaker 3: Are impatient presumably Yeah, yeah, yeah, one the faster you

870
00:43:58,159 --> 00:44:00,679
get it up there too. I mean there's from a

871
00:44:00,719 --> 00:44:04,079
pure marketing and se O. Your SEU has good. If

872
00:44:04,079 --> 00:44:06,320
you've got a quicker to click time, your SEO is

873
00:44:06,360 --> 00:44:08,280
going to go up. Your marketing people are going to

874
00:44:08,320 --> 00:44:10,599
be happier, Like, there's all the reasons right right.

875
00:44:11,199 --> 00:44:14,840
Speaker 1: People are never happy happy? Did I say that out loud?

876
00:44:14,920 --> 00:44:19,880
I feel bad. You want some fun when you're working

877
00:44:19,920 --> 00:44:22,440
in a development shop, go talk to the sales guys.

878
00:44:22,519 --> 00:44:25,159
Oh yeah, oh yeah, they don't like us. You know,

879
00:44:25,320 --> 00:44:27,679
they do not like us in the end, and we

880
00:44:27,719 --> 00:44:30,480
don't like them because they promise features you know that

881
00:44:31,079 --> 00:44:32,920
you don't even know about. You don't even know about

882
00:44:33,000 --> 00:44:35,559
much less know when you're delivered. Good idea to have

883
00:44:35,679 --> 00:44:37,679
lunch with a sales guy once a week. What have

884
00:44:37,760 --> 00:44:41,920
you promised this year? A good idea for the manager?

885
00:44:41,920 --> 00:44:43,400
Speaker 3: Where did you get your estimates?

886
00:44:43,639 --> 00:44:45,039
Speaker 1: Yeah? What lines have you told?

887
00:44:45,119 --> 00:44:45,280
Speaker 5: Oh?

888
00:44:45,360 --> 00:44:46,920
Speaker 3: You just rolled a handful of dies?

889
00:44:47,480 --> 00:44:52,880
Speaker 1: Got it? I remember working for a software company and

890
00:44:53,760 --> 00:44:59,199
he basically used the word on all the time as

891
00:44:59,239 --> 00:45:02,559
a verb. Something of part of his job description was

892
00:45:02,559 --> 00:45:06,679
constantly unaff ing the things that need that were screwed up.

893
00:45:07,119 --> 00:45:08,239
He was an angry man.

894
00:45:11,480 --> 00:45:17,639
Speaker 3: I've never used I've never used the F word in relationships,

895
00:45:17,719 --> 00:45:19,119
my job, or anything I was doing.

896
00:45:19,199 --> 00:45:25,039
Speaker 1: Never, no, no, never never never. Okay, you heard it

897
00:45:25,119 --> 00:45:29,800
here first, folks. It's actually not a bad job title,

898
00:45:29,960 --> 00:45:39,440
you know, Carl Franklin. It's like, oh, you're the as man.

899
00:45:40,960 --> 00:45:43,000
Speaker 3: We had a q I person we called the Harborder

900
00:45:43,079 --> 00:45:44,199
of Doom for a long time.

901
00:45:44,719 --> 00:45:49,400
Speaker 1: I like that the Arbor of Doom approaches.

902
00:45:50,920 --> 00:45:52,239
Speaker 3: In terms of fun titles.

903
00:45:54,280 --> 00:45:55,559
Speaker 1: Yeah, definitely.

904
00:45:55,599 --> 00:45:58,079
Speaker 2: When I was in my INFOSEC roles, it was like, oh,

905
00:45:58,159 --> 00:46:00,360
here comes the business impediment off.

906
00:46:06,920 --> 00:46:08,639
Speaker 3: Now which role was that? Because I can think of

907
00:46:08,719 --> 00:46:09,599
multiple roles for that.

908
00:46:09,719 --> 00:46:12,880
Speaker 1: Yeah. Yeah, there's a bunch of folks like that. You

909
00:46:12,880 --> 00:46:17,440
could argue the QA guys that, but INFOSEC especially, Yeah. Yeah,

910
00:46:18,400 --> 00:46:22,760
you will authenticate this person before anything proceeds. Sellers to that.

911
00:46:23,039 --> 00:46:24,639
You know what though, I mean, you know, if you

912
00:46:24,719 --> 00:46:28,000
have special roles in your database for users that they're

913
00:46:28,000 --> 00:46:29,559
never going to see what they are, you can make

914
00:46:29,599 --> 00:46:36,480
them whatever you want, right, So get creative. Some day

915
00:46:36,639 --> 00:46:40,119
that person realizes you tag their role as Harborder of Doom.

916
00:46:41,000 --> 00:46:45,320
Some day Harboringer of Doom.

917
00:46:49,280 --> 00:46:51,239
Speaker 4: I did have a client once. One of the first

918
00:46:51,239 --> 00:46:52,920
things I had to do for them is they asked me.

919
00:46:52,920 --> 00:46:56,920
They're like, okay, we've been laxed, but unfortunately now we're

920
00:46:56,960 --> 00:46:59,639
shipping you know, this bundle to our clients, and so

921
00:46:59,679 --> 00:47:01,639
they can see our code. You need to go through

922
00:47:02,360 --> 00:47:04,760
and find all the profanity and.

923
00:47:04,719 --> 00:47:12,880
Speaker 1: Remove and also just like comments like wtf what was

924
00:47:12,920 --> 00:47:16,440
I thinking? My family clearly wrote this because nobody else

925
00:47:16,480 --> 00:47:18,199
could have No.

926
00:47:18,360 --> 00:47:20,719
Speaker 3: My favorite was the number of times I all because

927
00:47:20,760 --> 00:47:23,199
I E. And I've written this in code basiness before.

928
00:47:23,280 --> 00:47:25,119
So it made me double laugh because I was like,

929
00:47:25,199 --> 00:47:27,920
I haven't touched this before. How is my comments in here?

930
00:47:28,480 --> 00:47:31,159
Because I E. Is being a little sleep.

931
00:47:33,159 --> 00:47:37,000
Speaker 1: Yes, that's legit. They shouldn't even be removed. That's just

932
00:47:37,039 --> 00:47:46,400
being honest, right right, I E. I E. Defect resistance requirements. Yep,

933
00:47:47,039 --> 00:47:50,079
Like wtf I see that in code all the time?

934
00:47:51,960 --> 00:47:55,719
Who wrote this crap? Well?

935
00:47:56,159 --> 00:47:58,840
Speaker 2: I had a standard tag, you know, like a paragraph

936
00:47:58,880 --> 00:48:00,760
at the top of each of the perform misdoing things.

937
00:48:00,840 --> 00:48:02,360
Just like if this doesn't make sense to you, do

938
00:48:02,480 --> 00:48:05,199
not touch it. Yeah, ask someone else.

939
00:48:06,920 --> 00:48:09,679
Speaker 3: Yeah, yeah, I do have a I do have a

940
00:48:09,679 --> 00:48:12,960
phone on a project. If you think about touching this file,

941
00:48:13,039 --> 00:48:13,800
I will haunt you.

942
00:48:15,199 --> 00:48:19,639
Speaker 1: Yeah. The curse the curse, curse on your head comes

943
00:48:19,639 --> 00:48:22,440
your Liam Neeson. I will find you and I will

944
00:48:22,519 --> 00:48:22,880
kill you.

945
00:48:25,960 --> 00:48:26,360
Speaker 3: Yes.

946
00:48:27,199 --> 00:48:30,079
Speaker 1: Oh what the heck? Were we talking about JavaScript?

947
00:48:30,960 --> 00:48:32,400
Speaker 3: Of JavaScript and where we love it?

948
00:48:32,519 --> 00:48:35,039
Speaker 1: Yeah, the wonders. That's why we got to profanity. It

949
00:48:35,039 --> 00:48:42,840
was inevitable. I mean, oh man, oh man. Well I'm

950
00:48:42,840 --> 00:48:46,639
really grateful. This is a great explanation. It seems it

951
00:48:46,719 --> 00:48:48,760
seems like you shouldn't be afraid of this stuff. It's

952
00:48:48,760 --> 00:48:50,760
been and it's been true for a few years now.

953
00:48:50,800 --> 00:48:53,760
Like I just double checked, and like since roughly twenty

954
00:48:53,760 --> 00:48:56,880
twenty one, every browser responded more or less the same

955
00:48:56,920 --> 00:48:58,920
to this, so you can count on it.

956
00:48:59,039 --> 00:49:01,599
Speaker 3: That's good and available in Node as well, so if

957
00:49:01,599 --> 00:49:03,440
you're in you know, if you're in that side of

958
00:49:03,480 --> 00:49:07,440
the universe, it does totally work there too, which is

959
00:49:07,480 --> 00:49:07,920
super cool.

960
00:49:07,960 --> 00:49:10,639
Speaker 2: If you weren't frustrated enough with no JS, try ASNC

961
00:49:10,679 --> 00:49:11,280
and no j as.

962
00:49:11,920 --> 00:49:13,039
Speaker 1: Yeah.

963
00:49:13,039 --> 00:49:15,280
Speaker 3: Well that's the thing though for a node for a

964
00:49:15,360 --> 00:49:17,719
long time you had to have a package for doing

965
00:49:17,760 --> 00:49:22,840
a sync and so now it's actually legitimately available in node.

966
00:49:23,159 --> 00:49:25,920
Speaker 1: They're using the engine. Yeah, because it's part of the language.

967
00:49:26,000 --> 00:49:30,320
Yeah right, yeah, that's good. Uh well, Martine Is there

968
00:49:30,320 --> 00:49:32,840
anything that we missed that you want to anything? You

969
00:49:32,880 --> 00:49:35,440
want to plug or talk about your book? You said

970
00:49:35,440 --> 00:49:36,280
you wrote a paper.

971
00:49:36,559 --> 00:49:40,960
Speaker 3: Oh, I'm I mean I have my blog articles up

972
00:49:40,960 --> 00:49:45,599
on the blog for Andromeda Galactic dot com. I also twitch.

973
00:49:46,159 --> 00:49:50,159
I'm working on moving my Twitch to Monday nights. So

974
00:49:50,519 --> 00:49:55,039
definitely come look food, look for me there. Don't hesitate

975
00:49:55,079 --> 00:49:58,199
to come say hi. It's kind of hip random what

976
00:49:58,280 --> 00:50:01,800
will hit but it'll be front and dev something and you.

977
00:50:01,719 --> 00:50:04,440
Speaker 1: Have Martine dot dev. Can you code and chat at

978
00:50:04,480 --> 00:50:08,280
the same time like that? I can't really challenge that's crazy.

979
00:50:08,039 --> 00:50:11,119
Speaker 3: As long as it's something like there's so much in

980
00:50:11,280 --> 00:50:15,960
UI that's memorization, that's the same stuff no matter what.

981
00:50:16,039 --> 00:50:19,639
Like yeah, I might do my column with's through my robe.

982
00:50:20,039 --> 00:50:22,960
Height's a little bit different depending on the layout. But realistically,

983
00:50:23,000 --> 00:50:25,880
writing a writing the CSS to write a great is

984
00:50:25,880 --> 00:50:27,440
going to be more or less the same every time,

985
00:50:27,559 --> 00:50:29,920
or a flex or whatever. Yeah, as long as I

986
00:50:29,960 --> 00:50:32,039
figured out what I'm going to write most of the

987
00:50:32,079 --> 00:50:36,000
actual typing it out, I can do well. Chatting nice,

988
00:50:36,119 --> 00:50:37,280
not too difficultly.

989
00:50:37,440 --> 00:50:41,440
Speaker 1: And your your personal website is Martin dot dev right correct?

990
00:50:41,760 --> 00:50:44,239
Speaker 3: Yes, And all the links are all there.

991
00:50:44,360 --> 00:50:47,119
Speaker 1: Yeah, stream links there, the blog links there, like everything

992
00:50:47,159 --> 00:50:48,679
you need is there. You told us the story, but

993
00:50:48,760 --> 00:50:50,199
tell the users how you got that.

994
00:50:50,679 --> 00:50:54,159
Speaker 3: So when the dot dev extension came out for being

995
00:50:54,159 --> 00:50:56,599
able to get domains, the first thing I did, and

996
00:50:56,679 --> 00:50:58,679
like right came out. I want to look, I wanted

997
00:50:58,679 --> 00:51:01,679
to get Martin dot dev and it was Bob, and

998
00:51:01,880 --> 00:51:08,280
I cussed up because I never used the F word,

999
00:51:08,360 --> 00:51:10,760
so it was definitely not used in this use case.

1000
00:51:11,360 --> 00:51:14,320
Cursing of whoever might have bought it, et cetera, et cetera,

1001
00:51:14,400 --> 00:51:18,480
et cetera. It turned out that my partner Michael had

1002
00:51:18,480 --> 00:51:21,239
bought it for me, so so nice.

1003
00:51:21,079 --> 00:51:26,440
Speaker 2: A story from rage to delight exactly.

1004
00:51:26,519 --> 00:51:29,239
Speaker 1: I mean, that's that's like if I had Carl dot com.

1005
00:51:29,320 --> 00:51:33,000
You know, that's really good Martin dot dev fantastic, really good.

1006
00:51:33,159 --> 00:51:34,920
Speaker 3: Yeah well, I mean it has the advantage of not

1007
00:51:34,960 --> 00:51:37,440
being too common of a name, so got lucky.

1008
00:51:37,440 --> 00:51:40,480
Speaker 1: I'm not well, this has been great, Thank you very much, Martine.

1009
00:51:40,599 --> 00:51:43,000
And uh, well we'll talk to you probably in a

1010
00:51:43,039 --> 00:51:44,840
year or so, because we seem to be talking to

1011
00:51:44,880 --> 00:51:49,039
you once a year. Yeah.

1012
00:51:47,760 --> 00:51:51,360
Speaker 3: Yeah, well, I'll be delighted to come back anytime you

1013
00:51:51,400 --> 00:51:51,719
want me.

1014
00:51:52,000 --> 00:51:54,599
Speaker 1: Great, Thanks all right, and we'll talk to you next

1015
00:51:54,639 --> 00:52:18,840
time on dot net rocks. Dot net rocks is brought

1016
00:52:18,840 --> 00:52:22,280
to you by Franklin's Net and produced by Pop Studios,

1017
00:52:22,639 --> 00:52:26,679
a full service audio, video and post production facility located

1018
00:52:26,719 --> 00:52:29,639
physically in New London, Connecticut, and of course in the

1019
00:52:29,679 --> 00:52:33,599
cloud online at pwop dot com.

1020
00:52:33,760 --> 00:52:35,920
Speaker 5: Visit our website at d O T N E t

1021
00:52:36,159 --> 00:52:40,159
R O c k S dot com for RSS feeds, downloads,

1022
00:52:40,320 --> 00:52:44,000
mobile apps, comments, and access to the full archives going

1023
00:52:44,039 --> 00:52:46,639
back to show number one, recorded.

1024
00:52:46,159 --> 00:52:48,920
Speaker 1: In September two thousand and two. And make sure you

1025
00:52:49,000 --> 00:52:52,119
check out our sponsors. They keep us in business. Now,

1026
00:52:52,159 --> 00:52:54,400
go write some code, see you next time.

1027
00:52:55,280 --> 00:52:55,719
Speaker 5: You got you

1028
00:53:00,880 --> 00:53:06,079
Speaker 3: D that Bess home and my taxes a line d

