WEBVTT

1
00:00:00.080 --> 00:00:02.080
<v Speaker 1>Have you ever looked at some new tech, maybe a

2
00:00:02.080 --> 00:00:05.280
<v Speaker 1>programming language, and just thought, Okay, I need to understand this,

3
00:00:05.480 --> 00:00:08.720
<v Speaker 1>but where do I even begin with all the info

4
00:00:08.759 --> 00:00:12.359
<v Speaker 1>out there. Well, today we're cutting right through the noise.

5
00:00:12.599 --> 00:00:15.679
<v Speaker 2>We are, indeed, we're taking a deep dive into Cotland.

6
00:00:15.720 --> 00:00:18.559
<v Speaker 2>That's the language that's been making some serious waves, you know,

7
00:00:18.960 --> 00:00:21.960
<v Speaker 2>especially since Google really embraced it for Android development.

8
00:00:22.079 --> 00:00:24.640
<v Speaker 1>Right, the Google announcement was huge, and you've given us

9
00:00:24.640 --> 00:00:27.199
<v Speaker 1>a fantastic guide to work from for this deep dive,

10
00:00:27.480 --> 00:00:31.120
<v Speaker 1>the Ultimate Beginner's Guide to learn Cotland Programming step by

11
00:00:31.120 --> 00:00:34.159
<v Speaker 1>step from twenty twenty. So our mission today is basically

12
00:00:34.159 --> 00:00:37.320
<v Speaker 1>to pull out the core ideas from that guide, explain

13
00:00:37.399 --> 00:00:41.719
<v Speaker 1>what makes Cotland well tick, why developers seem.

14
00:00:41.560 --> 00:00:43.960
<v Speaker 2>To really like it, exactly, why they call it a

15
00:00:44.000 --> 00:00:46.880
<v Speaker 2>breath of fresh air. We'll unpack its key features. Yeah,

16
00:00:47.200 --> 00:00:49.560
<v Speaker 2>see how it stacks up against languages people might know,

17
00:00:49.679 --> 00:00:52.920
<v Speaker 2>like a Java or Skala, and we'll even touch on

18
00:00:52.960 --> 00:00:55.280
<v Speaker 2>how it's actually being used out there in the real world.

19
00:00:55.359 --> 00:00:57.600
<v Speaker 1>So what does this all mean for you the listener,

20
00:00:57.679 --> 00:01:00.280
<v Speaker 1>whether you're maybe thinking about picking up a new skill

21
00:01:00.759 --> 00:01:03.079
<v Speaker 1>or just want to understand the tech landscape A bit better,

22
00:01:03.399 --> 00:01:07.319
<v Speaker 1>or maybe you're just curious. Let's unpack this. Okay, let's

23
00:01:07.359 --> 00:01:11.079
<v Speaker 1>kick things out with the basics. What is Cotland fundamentally.

24
00:01:10.560 --> 00:01:13.280
<v Speaker 2>Well, it's not brand brand new. The one point oh

25
00:01:13.319 --> 00:01:17.480
<v Speaker 2>release was back in February twenty sixteen. Okay, but yeah,

26
00:01:17.519 --> 00:01:20.599
<v Speaker 2>the guide calls it the new love child of the

27
00:01:20.719 --> 00:01:25.079
<v Speaker 2>JVM developers world, which is quite a statement, it really is.

28
00:01:25.200 --> 00:01:27.200
<v Speaker 1>Suggests it's more than just another option.

29
00:01:27.239 --> 00:01:30.879
<v Speaker 2>Definitely, and that breath of fresh air comment keeps coming up.

30
00:01:31.000 --> 00:01:33.359
<v Speaker 2>People see it as a really good upgrade, especially if

31
00:01:33.359 --> 00:01:36.079
<v Speaker 2>you're coming from say, older Java versions.

32
00:01:36.159 --> 00:01:38.439
<v Speaker 1>So let's dig into that comparison with Java. What makes

33
00:01:38.439 --> 00:01:40.760
<v Speaker 1>Cotland different? Why is it seen as better?

34
00:01:41.000 --> 00:01:45.000
<v Speaker 2>The guide highlights two main things. It's much safer and

35
00:01:45.040 --> 00:01:46.560
<v Speaker 2>more concise than Java.

36
00:01:46.640 --> 00:01:48.719
<v Speaker 1>Safer and more concise. How so, Well, it.

37
00:01:48.680 --> 00:01:52.959
<v Speaker 2>Adds features that directly address things Java developers have, let's say,

38
00:01:53.120 --> 00:01:54.799
<v Speaker 2>grown to dislike over the years.

39
00:01:54.879 --> 00:01:57.280
<v Speaker 1>Okay, Like, what give us some examples.

40
00:01:57.319 --> 00:02:00.519
<v Speaker 2>Big one null safety built right into the time system

41
00:02:00.519 --> 00:02:03.159
<v Speaker 2>to help prevent those dreaded null pointer exceptions.

42
00:02:03.200 --> 00:02:05.200
<v Speaker 1>Ah, the billion dollar mistake.

43
00:02:04.920 --> 00:02:08.199
<v Speaker 2>Right exactly. Then you have things like extension functions, adding

44
00:02:08.240 --> 00:02:13.159
<v Speaker 2>functionality to existing classes without needing to inherit super handy. Also,

45
00:02:13.479 --> 00:02:17.599
<v Speaker 2>data classes these massively cut down on boilerplate code.

46
00:02:17.639 --> 00:02:21.400
<v Speaker 1>Boilerplate yeah, like getters, setters equals.

47
00:02:20.919 --> 00:02:24.000
<v Speaker 2>Hash code precisely that. Plus it has better support for

48
00:02:24.280 --> 00:02:29.719
<v Speaker 2>functional programming, first class functions, really expressive lambdas and improvements

49
00:02:29.719 --> 00:02:33.319
<v Speaker 2>and type inference, the type system generally, and even the

50
00:02:33.319 --> 00:02:35.120
<v Speaker 2>collections library feels more modern.

51
00:02:35.240 --> 00:02:37.800
<v Speaker 1>Okay, that data class point sounds really interesting. Can you

52
00:02:37.800 --> 00:02:39.879
<v Speaker 1>make that a bit more tangible? Like? How bad is

53
00:02:39.919 --> 00:02:41.520
<v Speaker 1>it in Java versus Cotlin?

54
00:02:41.680 --> 00:02:42.000
<v Speaker 2>Sure?

55
00:02:42.080 --> 00:02:42.159
<v Speaker 1>So?

56
00:02:42.360 --> 00:02:44.719
<v Speaker 2>In Java, if you want a simple class to just

57
00:02:44.759 --> 00:02:47.039
<v Speaker 2>hold some data what they call a pojo plain old

58
00:02:47.120 --> 00:02:50.560
<v Speaker 2>Java object, you end up writing, honestly, dozens of lines.

59
00:02:50.639 --> 00:02:53.639
<v Speaker 2>You need fields, a constructor, getters for each field, setters

60
00:02:53.639 --> 00:02:55.639
<v Speaker 2>maybe equals hash code sash string.

61
00:02:55.960 --> 00:03:00.159
<v Speaker 1>Ough. Yeah, even with helper libraries like Lombac, it's still ceremony.

62
00:03:00.240 --> 00:03:00.599
<v Speaker 1>It is.

63
00:03:01.319 --> 00:03:04.080
<v Speaker 2>Now compare that to colin. You can often achieve the

64
00:03:04.120 --> 00:03:08.120
<v Speaker 2>exact same thing with a single line like this data

65
00:03:08.159 --> 00:03:12.520
<v Speaker 2>class hexagon data class val x int val y int

66
00:03:12.599 --> 00:03:13.039
<v Speaker 2>val z.

67
00:03:13.479 --> 00:03:14.520
<v Speaker 1>Wow. Okay, that's it.

68
00:03:14.599 --> 00:03:17.719
<v Speaker 2>That's it. That one line gives you the properties equals

69
00:03:17.759 --> 00:03:22.080
<v Speaker 2>hash code two string, and even a useful copy function. Automatically.

70
00:03:22.199 --> 00:03:23.039
<v Speaker 1>That is concise.

71
00:03:23.400 --> 00:03:26.680
<v Speaker 2>Huge difference, massive, and it's not just data classes. Think

72
00:03:26.719 --> 00:03:27.919
<v Speaker 2>about string formatting.

73
00:03:28.080 --> 00:03:31.080
<v Speaker 1>Yeah, Java's string dot format or just plus signing strings

74
00:03:31.080 --> 00:03:32.680
<v Speaker 1>together can get messy, right.

75
00:03:32.599 --> 00:03:35.879
<v Speaker 2>Colin has string templates or interpolation. It's much cleaner. You

76
00:03:35.919 --> 00:03:39.039
<v Speaker 2>can just write something like fun to human readable format

77
00:03:39.879 --> 00:03:43.159
<v Speaker 2>Java user name age age. See how the variables are

78
00:03:43.199 --> 00:03:43.759
<v Speaker 2>right in the string.

79
00:03:43.800 --> 00:03:44.840
<v Speaker 1>Yeah, that's much clearer.

80
00:03:45.120 --> 00:03:47.960
<v Speaker 2>And you can even put expressions or function calls inside

81
00:03:48.240 --> 00:03:51.879
<v Speaker 2>fun to human readable format with method call Java user

82
00:03:52.280 --> 00:03:53.759
<v Speaker 2>name dot capitalize.

83
00:03:53.800 --> 00:03:55.599
<v Speaker 1>Oh nice, so you can call capitalize right there.

84
00:03:55.800 --> 00:03:57.919
<v Speaker 2>Yep, super readable, super convenient.

85
00:03:58.400 --> 00:04:02.199
<v Speaker 1>Okay, So it's clearly guided manages over Java inconciseness and

86
00:04:02.240 --> 00:04:06.120
<v Speaker 1>some safey features. What about Scala You mentioned that earlier, right.

87
00:04:06.080 --> 00:04:11.159
<v Speaker 2>Scala another JVM language also known for functional programming. Scala

88
00:04:11.240 --> 00:04:14.280
<v Speaker 2>sometimes gets a reputation for being, as the guide puts it,

89
00:04:14.599 --> 00:04:16.199
<v Speaker 2>intriguing and frightening.

90
00:04:16.439 --> 00:04:16.920
<v Speaker 1>Frightening.

91
00:04:17.000 --> 00:04:21.439
<v Speaker 2>Why, well, it dives deep into some pretty advanced functional concepts,

92
00:04:21.720 --> 00:04:25.439
<v Speaker 2>higher kinded types, category theory stuff. It can have a

93
00:04:25.439 --> 00:04:30.360
<v Speaker 2>steeper learning curve. Oh okay, and sometimes longer compile times

94
00:04:30.399 --> 00:04:31.600
<v Speaker 2>have been a factor historically.

95
00:04:31.959 --> 00:04:34.399
<v Speaker 1>So how does Cotland compare. Is it just as complex?

96
00:04:34.920 --> 00:04:37.839
<v Speaker 2>That's the interesting part. The guide says Cotland is similar,

97
00:04:37.920 --> 00:04:41.839
<v Speaker 2>but only slightly similar in every aspecting it means. Cotland

98
00:04:41.920 --> 00:04:46.680
<v Speaker 2>gives you powerful functional features, maps, filters, folds, lambdas, but

99
00:04:46.800 --> 00:04:50.319
<v Speaker 2>generally without the really complex abstract stuff from Scala. If

100
00:04:50.360 --> 00:04:53.439
<v Speaker 2>you're a Java dev who's used Java eight streams and lambdas,

101
00:04:53.439 --> 00:04:56.040
<v Speaker 2>you'll feel pretty comfortable with Cotland's functional side.

102
00:04:56.079 --> 00:04:58.360
<v Speaker 1>So it's like functional programming made more approachable.

103
00:04:58.519 --> 00:05:00.879
<v Speaker 2>That's a good way to put it. More pragmate, perhaps

104
00:05:01.399 --> 00:05:02.279
<v Speaker 2>less academic.

105
00:05:02.759 --> 00:05:05.680
<v Speaker 1>And what about fitting in with existing Java projects? Is

106
00:05:05.680 --> 00:05:06.399
<v Speaker 1>it all or nothing?

107
00:05:06.680 --> 00:05:09.079
<v Speaker 2>Not at all? That's a huge selling point. Cotland is

108
00:05:09.079 --> 00:05:13.199
<v Speaker 2>one hundred percent compatible with Java, one hundred percent runs

109
00:05:13.199 --> 00:05:16.519
<v Speaker 2>on the JVM, compiles to Java byte code. You can

110
00:05:16.560 --> 00:05:19.920
<v Speaker 2>call Java code from Cotland and Cotland code from Java seamlessly.

111
00:05:20.160 --> 00:05:20.519
<v Speaker 1>Wow.

112
00:05:20.680 --> 00:05:23.360
<v Speaker 2>Okay, So you can introduce it gradually exactly, You can

113
00:05:23.360 --> 00:05:26.079
<v Speaker 2>start using it in parts of your existing Java application.

114
00:05:26.560 --> 00:05:29.519
<v Speaker 2>It matches well with existing Java code, As the guide says,

115
00:05:29.800 --> 00:05:34.680
<v Speaker 2>you get to keep using the whole Java ecosystem, libraries, frameworks.

116
00:05:34.120 --> 00:05:36.920
<v Speaker 1>Tools, and you mentioned it can even compile the JavaScript.

117
00:05:37.120 --> 00:05:40.600
<v Speaker 2>It can, which opens up possibilities for sharing code between

118
00:05:40.600 --> 00:05:44.600
<v Speaker 2>your back end and front end, potentially programming both in Cotland.

119
00:05:44.199 --> 00:05:48.240
<v Speaker 1>That's pretty compelling. So summarizing the why, it seems Cotlan

120
00:05:48.319 --> 00:05:52.439
<v Speaker 1>aims to fix Java's pain points, offers approachable functional programming,

121
00:05:52.680 --> 00:05:54.920
<v Speaker 1>and works perfectly with Java pretty much.

122
00:05:55.000 --> 00:05:57.279
<v Speaker 2>The guide says it solves many problems in Java, but

123
00:05:57.519 --> 00:05:59.480
<v Speaker 2>adds only a thin layer of complexity.

124
00:05:59.560 --> 00:06:03.120
<v Speaker 1>And speaking for you, the listener, why should you care?

125
00:06:03.360 --> 00:06:06.439
<v Speaker 2>Well? The source puts it bluntly. It helps you pay

126
00:06:06.439 --> 00:06:08.040
<v Speaker 2>bills and is so easy to use.

127
00:06:08.240 --> 00:06:10.879
<v Speaker 1>Huh. Okay, maybe a bit simplistic, but the point is clear.

128
00:06:11.160 --> 00:06:15.560
<v Speaker 1>Developer productivity, fewer errors, faster development that translates to.

129
00:06:15.560 --> 00:06:19.360
<v Speaker 2>Value absolutely less frustration, more getting things done.

130
00:06:19.480 --> 00:06:21.759
<v Speaker 1>Okay, let's shift gears slightly and dig into some of

131
00:06:21.800 --> 00:06:25.480
<v Speaker 1>Colin's core features. How does it handle basic things like

132
00:06:25.600 --> 00:06:27.079
<v Speaker 1>data types and control flow?

133
00:06:27.360 --> 00:06:31.759
<v Speaker 2>Right? The fundamentals. Even here there are some neat twists

134
00:06:32.120 --> 00:06:34.759
<v Speaker 2>like what well? First off, in Cotlin, pretty much every

135
00:06:34.839 --> 00:06:36.279
<v Speaker 2>element is an object.

136
00:06:36.399 --> 00:06:38.519
<v Speaker 1>Everything's an object, even basic numbers.

137
00:06:38.360 --> 00:06:41.839
<v Speaker 2>Yep means you can call member functions and properties on

138
00:06:42.000 --> 00:06:44.240
<v Speaker 2>any variable which has a nice consistency.

139
00:06:44.519 --> 00:06:47.600
<v Speaker 1>Interesting, What about numbers specifically, or are they like Java's

140
00:06:47.680 --> 00:06:49.519
<v Speaker 1>int float, et cetera similar.

141
00:06:49.639 --> 00:06:52.240
<v Speaker 2>Yeah, you have INNT double float bite and so on,

142
00:06:52.600 --> 00:06:55.560
<v Speaker 2>But there's a key difference in conversions. Coughlin doesn't do

143
00:06:55.720 --> 00:06:59.480
<v Speaker 2>implicit widening conversions, so you can't just assign a byte

144
00:06:59.560 --> 00:07:01.600
<v Speaker 2>value to an int variable directly.

145
00:07:02.040 --> 00:07:06.279
<v Speaker 1>So in my byte like in Java wouldn't work correct.

146
00:07:06.279 --> 00:07:09.079
<v Speaker 2>You have to explicitly say my byte dot tarrant. It

147
00:07:09.120 --> 00:07:11.360
<v Speaker 2>forces you to be clear about the conversion.

148
00:07:11.120 --> 00:07:15.120
<v Speaker 1>Makes sense, prevents accidental data loss or unexpected behavior exactly.

149
00:07:15.199 --> 00:07:18.160
<v Speaker 2>Oh. And a small but nice feature for readability, you

150
00:07:18.160 --> 00:07:21.759
<v Speaker 2>can use underscores in number literals. Underscore Yeah, like wall

151
00:07:21.839 --> 00:07:25.759
<v Speaker 2>one million equals one hundred thousand zero makes large numbers

152
00:07:26.079 --> 00:07:27.079
<v Speaker 2>way easier to read.

153
00:07:27.439 --> 00:07:29.120
<v Speaker 1>That is neat. Okay, what about strings?

154
00:07:29.319 --> 00:07:32.720
<v Speaker 2>Strings are immutable like in Java, you can iterate through

155
00:07:32.720 --> 00:07:36.360
<v Speaker 2>the characters easily using a for loop for c and strings.

156
00:07:36.519 --> 00:07:38.879
<v Speaker 2>A cool feature is raw text.

157
00:07:38.600 --> 00:07:39.759
<v Speaker 1>Strings Raw texts.

158
00:07:39.800 --> 00:07:43.160
<v Speaker 2>Yeah, you use triple quotes do inside these you can

159
00:07:43.199 --> 00:07:46.399
<v Speaker 2>have new lines and special characters without needing escape sequences

160
00:07:46.439 --> 00:07:47.199
<v Speaker 2>like n oh.

161
00:07:47.199 --> 00:07:50.920
<v Speaker 1>That's useful for embedding like JSON or sequel.

162
00:07:50.600 --> 00:07:53.680
<v Speaker 2>Snippets precisely, And you can use a function called trim

163
00:07:53.720 --> 00:07:58.199
<v Speaker 2>margin to nicely format, multiline raw strings, removing leading white space.

164
00:07:58.279 --> 00:08:01.120
<v Speaker 1>Andy, and you mentioned string templates earlier.

165
00:08:00.879 --> 00:08:04.000
<v Speaker 2>Right, The name or expression syntax for embedding values directly

166
00:08:04.000 --> 00:08:05.480
<v Speaker 2>into strings. Very convenient.

167
00:08:05.560 --> 00:08:09.240
<v Speaker 1>Okay, Let's talk control flow if for a while. Any

168
00:08:09.279 --> 00:08:10.000
<v Speaker 1>surprises there.

169
00:08:10.360 --> 00:08:13.959
<v Speaker 2>The if statement is quite interesting. In Cotland. If is an.

170
00:08:13.879 --> 00:08:16.120
<v Speaker 1>Expression an expression meaning it returns a.

171
00:08:16.160 --> 00:08:18.959
<v Speaker 2>Value exactly, So you don't need a separate ternery operator

172
00:08:19.079 --> 00:08:22.279
<v Speaker 2>like condition dot value t dot value of false. You

173
00:08:22.319 --> 00:08:25.680
<v Speaker 2>can just write vale result if condition some value else

174
00:08:25.720 --> 00:08:29.160
<v Speaker 2>another value. Ah. Okay, so the result of the if

175
00:08:29.199 --> 00:08:32.720
<v Speaker 2>block gets assigned directly. Cleaner, much cleaner. Then there's when.

176
00:08:32.960 --> 00:08:33.519
<v Speaker 1>When is that?

177
00:08:33.600 --> 00:08:37.320
<v Speaker 2>Like switch and Java, it's Cotland's much more powerful alternative

178
00:08:37.320 --> 00:08:39.759
<v Speaker 2>to Swiss shadow. It's super flexible. You can match against

179
00:08:39.759 --> 00:08:43.759
<v Speaker 2>specific values, multiple values zero, one point zero ranges and

180
00:08:43.799 --> 00:08:47.159
<v Speaker 2>one point sero check types is string, or even use

181
00:08:47.279 --> 00:08:48.960
<v Speaker 2>arbitrary expressions as conditions.

182
00:08:48.960 --> 00:08:50.759
<v Speaker 1>Wow, sounds way more versatile than switch.

183
00:08:50.879 --> 00:08:54.279
<v Speaker 2>It really is, And just like if, when can also

184
00:08:54.360 --> 00:08:56.559
<v Speaker 2>be used as an expression that returns a value.

185
00:08:56.799 --> 00:08:59.840
<v Speaker 1>Nice. What about loops for loops?

186
00:09:00.320 --> 00:09:03.600
<v Speaker 2>Standard for item in collection works as you'd expect for

187
00:09:03.720 --> 00:09:06.639
<v Speaker 2>looping over arrays or lists where you need the index

188
00:09:06.679 --> 00:09:08.399
<v Speaker 2>You can use a rate out indices which gives you

189
00:09:08.440 --> 00:09:11.120
<v Speaker 2>a range of indices, or even better, a rate out

190
00:09:11.159 --> 00:09:14.519
<v Speaker 2>with index, which gives you pairs of index value in

191
00:09:14.559 --> 00:09:16.600
<v Speaker 2>each iteration. Very convenient.

192
00:09:16.799 --> 00:09:20.279
<v Speaker 1>Yeah. Avoids manual index tracking and while loops while one

193
00:09:20.320 --> 00:09:22.799
<v Speaker 1>do while it are pretty much standard, similar to how

194
00:09:22.799 --> 00:09:25.200
<v Speaker 1>they work in Java or other SE style languages. No

195
00:09:25.279 --> 00:09:29.000
<v Speaker 1>big surprises there. Okay, so far Cotland seems focused on

196
00:09:29.080 --> 00:09:34.120
<v Speaker 1>conciseness and adding practical improvements to familiar concepts. Let's move

197
00:09:34.200 --> 00:09:38.159
<v Speaker 1>up a level to how programs are structured classes.

198
00:09:38.000 --> 00:09:39.639
<v Speaker 2>Objects, right, the building block.

199
00:09:39.679 --> 00:09:42.480
<v Speaker 1>How do you define a class? Still class? Yep.

200
00:09:42.840 --> 00:09:46.960
<v Speaker 2>Declaring a class is simple class invoice, but creating an

201
00:09:46.960 --> 00:09:47.960
<v Speaker 2>instance is different.

202
00:09:48.200 --> 00:09:49.639
<v Speaker 1>Also, no new keyword.

203
00:09:49.840 --> 00:09:54.720
<v Speaker 2>You just call the constructor like a regular function veil invoice, invoice.

204
00:09:54.440 --> 00:09:56.360
<v Speaker 1>Uh, simpler. What about constructors.

205
00:09:56.440 --> 00:09:59.080
<v Speaker 2>Potland has a concept of a primary constructor, which is

206
00:09:59.120 --> 00:10:01.440
<v Speaker 2>part of the class head itself, and you can also

207
00:10:01.480 --> 00:10:05.120
<v Speaker 2>have secondary constructors declared with the constructor keyword inside the

208
00:10:05.120 --> 00:10:08.159
<v Speaker 2>class body. Any initialization code that needs to run for

209
00:10:08.200 --> 00:10:10.799
<v Speaker 2>the primary constructor goes into in it blocks.

210
00:10:11.000 --> 00:10:14.159
<v Speaker 1>And you mentioned earlier that property declaration can be very concise.

211
00:10:14.600 --> 00:10:18.159
<v Speaker 2>Yeah, this ties into the primary constructor, You can declare

212
00:10:18.200 --> 00:10:21.919
<v Speaker 2>properties and initialize them directly in the primary constructor's signature,

213
00:10:22.360 --> 00:10:27.600
<v Speaker 2>like class person full first name string, VOWL, last name string, var,

214
00:10:27.759 --> 00:10:32.240
<v Speaker 2>age int that declares three properties first name, last name, age,

215
00:10:32.440 --> 00:10:36.080
<v Speaker 2>and the primary constructor takes arguments to initialize them. Vall

216
00:10:36.279 --> 00:10:38.440
<v Speaker 2>means read only, var means mutable.

217
00:10:38.639 --> 00:10:42.240
<v Speaker 1>Again, very concise compared to Java's constructor boiler plate definitely.

218
00:10:42.320 --> 00:10:44.720
<v Speaker 1>What about inheritance, Can any class be extended?

219
00:10:44.799 --> 00:10:47.120
<v Speaker 2>Nope? By default Cotland classes are.

220
00:10:47.039 --> 00:10:50.440
<v Speaker 1>Final final, meaning they cannot be inherited from correct.

221
00:10:50.519 --> 00:10:52.639
<v Speaker 2>If you want a class to be inheritable, you have

222
00:10:52.720 --> 00:10:55.399
<v Speaker 2>to explicitly market with the open keyword.

223
00:10:55.039 --> 00:10:57.360
<v Speaker 1>Okay, so it's opt in inheritance exactly.

224
00:10:57.720 --> 00:11:00.440
<v Speaker 2>Sam goes for methods or properties you want over rune,

225
00:11:00.679 --> 00:11:02.799
<v Speaker 2>the method in the base class must be marked open,

226
00:11:02.840 --> 00:11:05.320
<v Speaker 2>and the overwriting method in the derived class must be

227
00:11:05.399 --> 00:11:06.320
<v Speaker 2>marked override.

228
00:11:06.399 --> 00:11:09.000
<v Speaker 1>So it's very explicit. You have to declare your intention

229
00:11:09.159 --> 00:11:11.600
<v Speaker 1>to allow extension or overwriting. Right.

230
00:11:11.679 --> 00:11:15.279
<v Speaker 2>It avoids accidental inheritance or overwriting and makes APIs clearer.

231
00:11:15.399 --> 00:11:19.679
<v Speaker 1>What about static methods like utility functions associated with a

232
00:11:19.720 --> 00:11:23.759
<v Speaker 1>class but not an instance. Java uses static Colin.

233
00:11:23.519 --> 00:11:25.759
<v Speaker 2>Doesn't have a static keyword in the same way. For

234
00:11:25.799 --> 00:11:29.480
<v Speaker 2>functions that don't need class instance access, you can just

235
00:11:29.559 --> 00:11:32.159
<v Speaker 2>define them at the top level of a file outside

236
00:11:32.200 --> 00:11:35.200
<v Speaker 2>any class package level functions. Okay, but if you want

237
00:11:35.279 --> 00:11:39.039
<v Speaker 2>functions or properties tied conceptually to a class, like factory,

238
00:11:39.080 --> 00:11:42.360
<v Speaker 2>methods or constants, you use a companion.

239
00:11:41.879 --> 00:11:43.200
<v Speaker 1>Object companion object.

240
00:11:43.240 --> 00:11:45.519
<v Speaker 2>Yeah, it's an object declared inside a class with the

241
00:11:45.559 --> 00:11:48.639
<v Speaker 2>companion keyword. You can then call its members using the

242
00:11:48.639 --> 00:11:52.960
<v Speaker 2>class name directly like my class dot create, similar to

243
00:11:53.000 --> 00:11:54.799
<v Speaker 2>how you'd call a static method in Java.

244
00:11:55.080 --> 00:11:57.399
<v Speaker 1>So it serves a similar purpose to static it.

245
00:11:57.320 --> 00:12:00.759
<v Speaker 2>Does, but it's actually a real object at runtime, meaning

246
00:12:00.919 --> 00:12:05.679
<v Speaker 2>the companion object itself can implement interfaces or have extension functions,

247
00:12:05.720 --> 00:12:08.000
<v Speaker 2>which is more powerful than Java static members.

248
00:12:08.120 --> 00:12:12.039
<v Speaker 1>Interesting distinction. Let's talk more about properties val and var right.

249
00:12:12.399 --> 00:12:16.000
<v Speaker 2>Val for read only like Java final fields, var, forer

250
00:12:16.120 --> 00:12:17.559
<v Speaker 2>mutable pretty straightforward.

251
00:12:17.600 --> 00:12:21.200
<v Speaker 1>Can you customize how they work like custom getters or setters?

252
00:12:21.519 --> 00:12:25.000
<v Speaker 2>Absolutely. You can define custom get and set logic right

253
00:12:25.039 --> 00:12:29.279
<v Speaker 2>after the property declaration. For example, val is empty oulian

254
00:12:29.360 --> 00:12:32.879
<v Speaker 2>get this dot size equals hour zero. This defines a

255
00:12:32.960 --> 00:12:35.679
<v Speaker 2>read only is empty property whose value is calculated by

256
00:12:35.720 --> 00:12:37.120
<v Speaker 2>the getter each time it's accessed.

257
00:12:37.240 --> 00:12:41.240
<v Speaker 1>Got it. What about properties that can't be initialized immediately

258
00:12:41.240 --> 00:12:43.919
<v Speaker 1>in the constructor maybe they're set up by a dependency

259
00:12:43.919 --> 00:12:45.200
<v Speaker 1>injection framework later.

260
00:12:45.399 --> 00:12:48.799
<v Speaker 2>Ah, good question for that. Cotlin has the latin it

261
00:12:48.960 --> 00:12:52.200
<v Speaker 2>modifier latina. Yeah. You mark a var property with a

262
00:12:52.279 --> 00:12:54.919
<v Speaker 2>Latin it tells the compiler trust me, this non null

263
00:12:54.960 --> 00:12:57.279
<v Speaker 2>property will be initialized before I try to use it.

264
00:12:57.600 --> 00:12:59.879
<v Speaker 2>This lets you avoid initializing it to null just to

265
00:13:00.000 --> 00:13:02.960
<v Speaker 2>satisfy the compiler, and then you don't need null checks

266
00:13:03.000 --> 00:13:03.720
<v Speaker 2>everywhere later.

267
00:13:03.879 --> 00:13:06.879
<v Speaker 1>Okay, that handles a common scenario nicely. Now the guide

268
00:13:06.919 --> 00:13:11.240
<v Speaker 1>mentions something called delegated properties. That sounds advanced.

269
00:13:11.360 --> 00:13:14.200
<v Speaker 2>It's a really powerful concept, actually, maybe one of Cotland's

270
00:13:14.240 --> 00:13:16.919
<v Speaker 2>killer features. The idea is you can delegate the getter

271
00:13:16.960 --> 00:13:20.159
<v Speaker 2>and setter logic of a property to another object.

272
00:13:20.159 --> 00:13:21.799
<v Speaker 1>A delegate delegate the largic.

273
00:13:22.519 --> 00:13:26.639
<v Speaker 2>Why it lets you reuse common property behaviors without writing

274
00:13:26.639 --> 00:13:29.960
<v Speaker 2>boilerplate code over and over. The guide says, you can

275
00:13:30.000 --> 00:13:32.759
<v Speaker 2>define the use of properties manually over and over again,

276
00:13:33.240 --> 00:13:35.879
<v Speaker 2>but then store this definition in the library for use

277
00:13:35.919 --> 00:13:36.600
<v Speaker 2>whenever needed.

278
00:13:36.720 --> 00:13:38.200
<v Speaker 1>Okay, like what kind of behaviors?

279
00:13:38.320 --> 00:13:42.440
<v Speaker 2>Common examples built into the standard library include lazy properties

280
00:13:42.559 --> 00:13:45.440
<v Speaker 2>lazy yeah, The value of a lazy property is computed

281
00:13:45.519 --> 00:13:47.279
<v Speaker 2>only the first time you access it, and then the

282
00:13:47.279 --> 00:13:50.840
<v Speaker 2>result is cased. Great for expensive initializations you might not

283
00:13:50.960 --> 00:13:51.840
<v Speaker 2>always need.

284
00:13:52.000 --> 00:13:54.480
<v Speaker 1>I see performance optimization exactly.

285
00:13:54.720 --> 00:13:58.159
<v Speaker 2>Another one is observable properties. You provide a handler function

286
00:13:58.240 --> 00:14:00.879
<v Speaker 2>that gets called every time the property value changes.

287
00:14:01.120 --> 00:14:04.240
<v Speaker 1>Useful for like updating UI or logging changes.

288
00:14:04.360 --> 00:14:07.080
<v Speaker 2>Perfect for that. You can even delegate properties to store

289
00:14:07.120 --> 00:14:08.200
<v Speaker 2>their values in a map.

290
00:14:08.480 --> 00:14:12.039
<v Speaker 1>Wow. So it's a way to abstract common property patterns

291
00:14:12.039 --> 00:14:13.279
<v Speaker 1>into reusable delegates.

292
00:14:13.320 --> 00:14:16.720
<v Speaker 2>Precisely, it cleans up codes significantly by handling things like

293
00:14:16.840 --> 00:14:21.039
<v Speaker 2>lazy loading, observation, or even mapping properties to external data

294
00:14:21.080 --> 00:14:22.759
<v Speaker 2>sources in a standard way.

295
00:14:23.080 --> 00:14:26.919
<v Speaker 1>That sounds incredibly useful. Okay, let's zoom out again. We've

296
00:14:26.919 --> 00:14:30.480
<v Speaker 1>covered syntax and core features. How does this all come

297
00:14:30.519 --> 00:14:34.679
<v Speaker 1>together the broader developer experience? How is cotlin actually used well?

298
00:14:34.720 --> 00:14:38.000
<v Speaker 2>Besides Android, it's making huge strides in server side development.

299
00:14:38.159 --> 00:14:42.159
<v Speaker 1>Server side, with Java being so dominant that yep, Colin.

300
00:14:41.919 --> 00:14:44.879
<v Speaker 2>Is seen as a powerful tool for servers. It brings

301
00:14:44.879 --> 00:14:48.559
<v Speaker 2>that expressiveness and safety we talked about. Plus, it has

302
00:14:48.639 --> 00:14:52.320
<v Speaker 2>excellent support for concurrency with coroutines, which are very lightweight

303
00:14:52.440 --> 00:14:55.480
<v Speaker 2>compared to traditional threads leading to better scalability core to

304
00:14:55.559 --> 00:14:59.840
<v Speaker 2>teams right heard about those, And crucially that Java Interopera

305
00:15:00.480 --> 00:15:04.080
<v Speaker 2>means you can adopt it gradually in existing Java server applications.

306
00:15:04.120 --> 00:15:06.080
<v Speaker 2>It supports a step by step transition.

307
00:15:06.320 --> 00:15:08.720
<v Speaker 1>Are major framework supporting it like Spring?

308
00:15:09.000 --> 00:15:12.720
<v Speaker 2>Absolutely? Spring has first class Coughtland support dot x two

309
00:15:13.159 --> 00:15:16.200
<v Speaker 2>And there are Cotland native frameworks like Creator developed by

310
00:15:16.279 --> 00:15:17.360
<v Speaker 2>jet Brains themselves.

311
00:15:17.440 --> 00:15:19.440
<v Speaker 1>And are there big real world examples?

312
00:15:19.600 --> 00:15:22.159
<v Speaker 2>The guide mentions a couple of fascinating ones. The corna

313
00:15:22.200 --> 00:15:25.639
<v Speaker 2>platform that's an open distributed ledger platform used by major

314
00:15:25.720 --> 00:15:29.320
<v Speaker 2>banks for financial records, is built entirely in Cotlin entirely

315
00:15:29.440 --> 00:15:33.600
<v Speaker 2>wow Yeah, And jet Brain's own licensing system. Jet Brain's

316
00:15:33.600 --> 00:15:37.159
<v Speaker 2>account has apparently been running on Cotland since twenty fifteen

317
00:15:37.480 --> 00:15:40.240
<v Speaker 2>without major problems, so it's battle tested.

318
00:15:40.440 --> 00:15:43.759
<v Speaker 1>That's strong evidence of its maturity for server use. Okay,

319
00:15:43.840 --> 00:15:48.840
<v Speaker 1>beyond the language itself, what about conventions, style, guides, best practices.

320
00:15:49.120 --> 00:15:55.279
<v Speaker 2>Cotland generally follows established Java conventions for naming things, packages, classes, functions, properties, so.

321
00:15:55.320 --> 00:15:58.080
<v Speaker 1>Camel case for functions and variables, Pascal case.

322
00:15:57.919 --> 00:16:01.480
<v Speaker 2>For classes exactly. Constants tend to be all caps with underscores.

323
00:16:01.879 --> 00:16:06.679
<v Speaker 1>Pretty standard stuff, formatting tabs or spaces brace style.

324
00:16:06.480 --> 00:16:10.440
<v Speaker 2>The official recommendation is four spaces for indentation. Brace style

325
00:16:10.559 --> 00:16:12.679
<v Speaker 2>is similar to Java opening brace at the end of

326
00:16:12.720 --> 00:16:15.240
<v Speaker 2>the line, closing brace on its own line, and a

327
00:16:15.279 --> 00:16:18.279
<v Speaker 2>small but lovely detail. The guide points out semi collins

328
00:16:18.320 --> 00:16:19.399
<v Speaker 2>at the end of lines are.

329
00:16:19.320 --> 00:16:22.480
<v Speaker 1>Optional, optional semicolons. That's always a crowd pleaser, isn't it?

330
00:16:22.600 --> 00:16:24.360
<v Speaker 2>Just it cleans things up visually?

331
00:16:24.639 --> 00:16:27.600
<v Speaker 1>What about recommended coding patterns? Does the call in community

332
00:16:27.639 --> 00:16:28.840
<v Speaker 1>push certain styles?

333
00:16:29.000 --> 00:16:31.519
<v Speaker 2>Definitely? A big one is immutability.

334
00:16:31.080 --> 00:16:32.480
<v Speaker 1>Using val over var.

335
00:16:32.840 --> 00:16:36.879
<v Speaker 2>Yes, strongly encouraged. It is preferable to use static data

336
00:16:37.000 --> 00:16:40.799
<v Speaker 2>on the variable. The guide says favor val. Use immutable

337
00:16:40.799 --> 00:16:45.080
<v Speaker 2>collection interfaces list set map rather than mutable list, et

338
00:16:45.159 --> 00:16:46.240
<v Speaker 2>cetera whenever you.

339
00:16:46.240 --> 00:16:48.200
<v Speaker 1>Can why the emphasis makes.

340
00:16:48.000 --> 00:16:51.240
<v Speaker 2>Code easier to reason about, less prone to bugs caused

341
00:16:51.240 --> 00:16:54.720
<v Speaker 2>by unexpected state changes, especially in concurrent scenarios.

342
00:16:54.840 --> 00:16:57.120
<v Speaker 1>Makes sense any other key patterns.

343
00:16:56.840 --> 00:17:00.519
<v Speaker 2>Default parameter values are heavily used. Instead of writing multiple

344
00:17:00.559 --> 00:17:03.919
<v Speaker 2>overloaded functions, you just define default values for parameters in

345
00:17:03.960 --> 00:17:08.240
<v Speaker 2>a single function declaration leads to much cleaner APIs.

346
00:17:07.799 --> 00:17:11.519
<v Speaker 1>Right, avoids that explosion of method signatures thick exactly.

347
00:17:12.119 --> 00:17:16.519
<v Speaker 2>Also destructuring declarations. Destructuring was that it's a concise way

348
00:17:16.559 --> 00:17:19.759
<v Speaker 2>to unpack an object into multiple variables. Remember the data

349
00:17:19.759 --> 00:17:23.359
<v Speaker 2>class person, vowel, name, string, vowel age into Yeah, you

350
00:17:23.359 --> 00:17:27.480
<v Speaker 2>can write vowelname, age, person instance. Cotlan automatically calls generated

351
00:17:27.480 --> 00:17:31.039
<v Speaker 2>component one and component two functions to extract the values

352
00:17:31.079 --> 00:17:32.440
<v Speaker 2>into name and age variable.

353
00:17:32.519 --> 00:17:36.279
<v Speaker 1>Oh, needs you know to vowel name person dot name vowelage,

354
00:17:36.359 --> 00:17:37.400
<v Speaker 1>person dot age.

355
00:17:37.480 --> 00:17:41.559
<v Speaker 2>Correct. It's super useful when functions return multiple values, often

356
00:17:41.640 --> 00:17:45.279
<v Speaker 2>via a data class or pair, or when iterating over maps.

357
00:17:45.359 --> 00:17:46.480
<v Speaker 1>How does it work with maps?

358
00:17:46.599 --> 00:17:51.359
<v Speaker 2>You can loop like this for key value in my map.

359
00:17:51.640 --> 00:17:52.200
<v Speaker 1>Very elegant.

360
00:17:52.240 --> 00:17:55.240
<v Speaker 2>That is elegant. Also, ranges are used a lot for loops,

361
00:17:55.599 --> 00:17:59.519
<v Speaker 2>using until for exclusive ranges for i and zero, intel

362
00:17:59.599 --> 00:18:03.119
<v Speaker 2>size comments size, and you have down to and step

363
00:18:03.240 --> 00:18:03.960
<v Speaker 2>for more control.

364
00:18:04.440 --> 00:18:07.759
<v Speaker 1>Okay, what about those smart casts mentioned in the guide? Ah?

365
00:18:07.839 --> 00:18:10.400
<v Speaker 2>Yes, smart casts are great. Basically, if you perform a

366
00:18:10.480 --> 00:18:13.559
<v Speaker 2>type check like if X is string, the compiler is

367
00:18:13.599 --> 00:18:17.440
<v Speaker 2>smart enough to automatically treat X as a string inside that.

368
00:18:17.440 --> 00:18:19.839
<v Speaker 1>Block, so you don't need to explicitly cast it again.

369
00:18:19.960 --> 00:18:23.519
<v Speaker 2>Often no, the compiler automatically converts and securely when needed

370
00:18:23.559 --> 00:18:26.000
<v Speaker 2>within that scope, reduces casting.

371
00:18:25.680 --> 00:18:30.240
<v Speaker 1>Clutter, and finally, exceptions. Java has checked exceptions, which can

372
00:18:30.279 --> 00:18:33.000
<v Speaker 1>be controversial. How does Cotlin handle them?

373
00:18:33.039 --> 00:18:35.400
<v Speaker 2>Cotland gets rid of them entirely. It does not support

374
00:18:35.519 --> 00:18:36.920
<v Speaker 2>checked exceptions.

375
00:18:36.400 --> 00:18:37.759
<v Speaker 1>No checked exceptions at all.

376
00:18:38.119 --> 00:18:41.920
<v Speaker 2>Nope, it's a deliberate design choice. The thinking is that

377
00:18:41.960 --> 00:18:46.039
<v Speaker 2>forcing tricatch blocks for checked exceptions often leads to boilerplate

378
00:18:46.079 --> 00:18:50.240
<v Speaker 2>code that doesn't actually handle the error meaningfully, reducing productivity.

379
00:18:50.599 --> 00:18:53.960
<v Speaker 1>So all exceptions are effectively unchecked like runtime exceptions in Java.

380
00:18:54.039 --> 00:18:56.759
<v Speaker 2>Pretty much. Yes, it puts the onus on the developer

381
00:18:56.839 --> 00:19:00.720
<v Speaker 2>to decide when and how to handle potential exceptions rather

382
00:19:00.799 --> 00:19:02.480
<v Speaker 2>than forcing it through the type system.

383
00:19:02.960 --> 00:19:07.079
<v Speaker 1>Interesting, definitely different philosophy. Okay, so wrapping things that we've

384
00:19:07.079 --> 00:19:10.880
<v Speaker 1>gone through quite a journey here from Cotland's core philosophy

385
00:19:11.160 --> 00:19:12.759
<v Speaker 1>compared to Java and Scala.

386
00:19:12.880 --> 00:19:18.000
<v Speaker 2>Yeah, focusing on that conciseness, safety, and interoperability.

387
00:19:17.160 --> 00:19:21.200
<v Speaker 1>To its specific features like data classes, null safety, when expressions,

388
00:19:21.240 --> 00:19:23.839
<v Speaker 1>companion objects, delegated properties.

389
00:19:23.319 --> 00:19:28.279
<v Speaker 2>And the powerful conventions like immutability, default parameters, and smart casts.

390
00:19:28.680 --> 00:19:31.720
<v Speaker 1>It really feels like a language designed with developer productivity

391
00:19:31.839 --> 00:19:34.119
<v Speaker 1>and dare I say happiness in mind, I.

392
00:19:34.039 --> 00:19:37.200
<v Speaker 2>Think that's fair. It addresses many common frustrations and provides

393
00:19:37.279 --> 00:19:40.519
<v Speaker 2>elegant solutions while staying practical and interoperable.

394
00:19:40.799 --> 00:19:43.119
<v Speaker 1>So for you listening, you should now have a much

395
00:19:43.160 --> 00:19:46.640
<v Speaker 1>clearer picture of what Cotland is, why it's gained so

396
00:19:46.720 --> 00:19:48.839
<v Speaker 1>much traction, and the kind of problems it solves.

397
00:19:48.880 --> 00:19:51.960
<v Speaker 2>Ejectively, you've got a solid grasp of what makes it

398
00:19:52.079 --> 00:19:55.720
<v Speaker 2>well that breath of fresh air. For many developers, it's pragmatism,

399
00:19:55.920 --> 00:19:59.400
<v Speaker 2>it's clever features, and its strong ecosystem for building various

400
00:19:59.480 --> 00:20:00.599
<v Speaker 2>kinds of app iplations.

401
00:20:00.759 --> 00:20:03.200
<v Speaker 1>You know, this whole deep dive into Cotlan, seeing how

402
00:20:03.200 --> 00:20:06.839
<v Speaker 1>a tackled complexity and aimed for developer joy, it makes

403
00:20:06.839 --> 00:20:11.359
<v Speaker 1>you wonder, considering how much digital technology relies on complex systems,

404
00:20:11.839 --> 00:20:14.559
<v Speaker 1>what other areas could really benefit from a similar breath

405
00:20:14.599 --> 00:20:17.759
<v Speaker 1>of fresh air approach. Where else could we simplify things

406
00:20:17.759 --> 00:20:22.000
<v Speaker 1>and prioritize the actual user or developer experience over legacy

407
00:20:22.119 --> 00:20:23.359
<v Speaker 1>or perceived complexity.

408
00:20:23.519 --> 00:20:25.920
<v Speaker 2>Hmm, that's a great question, something for you to mul

409
00:20:25.960 --> 00:20:27.480
<v Speaker 2>over until our next deep dive
