A better way for learning Kotlin – link ‘how and why’
To actually retain the concepts I need, I want to ‘attach it’ to my overall goals. In the table below, I’ve listed the resource that will support each specific goal.
|Criteria||Resource to support goal||Measure of success|
|Be able to write Kotlin constructs on demand.||Kotlin Koans give me all the drills I need. I can review these drills any time I like.||Simply that I can remember the answer before being presented with it.|
|Be able to understand the philosophy beyond Kotlin usage over Java.||My worksheet will include a comparison that search for meaning for each Koan.||Each row in my worksheet can categorically state “What idea each Koan replacing in Java?”|
|Be able to apply Kotlin on work projects (me).||I have my worksheet to remind me of “why” to use Kotlin and “when” to use.||Reduced dependency on this worksheet as I write new code.|
|Be able to apply Kotlin on work projects (others).||I have my worksheet to remind me of “why” to use Kotlin and “when” to use.||Reduced dependency on this worksheet to as I review proposed code, or maintain existing code.|
Priming the Brain – The Kotlin Philosophy
For my goal, I think I will get more effective Kotlin learning from a bit of prep work. My goal is to understand the Kotlin philosophy. After all, I’m trying to beat my tendency to revert to Java. Let’s start with a summary of Kotlin from Wikipedia:
Kotlin (/ˈkɒtlɪn/) is a cross-platform, statically typed, general-purpose programming language with type inference. Kotlin is designed to interoperate fully with Java, and the JVM version of Kotlin’s standard library depends on the Java Class Library, but type inference allows its syntax to be more concise.Wikipedia description of Kotlin
Ok great, so the authors are looking to leverage type inference and write more concise code. This is also the goal as stated by the KotlinLang.org site. I’ll look out for those ideas in the koans as a starting point. I’m sure as I learn it will get more nuanced than that, but this is is a good starting point.
Also, let’s look at the general areas of the Kotlin Koans by looking at the broad areas covered by the koans. From the intro page, I can see the following course outline:
From this and the Kotlin philosophy on Wikipedia, I can probably guess that Kotlin is promoting more concise ways of using all the above than Java. Not only that, the broad areas above are the ones that the Koan authors deem important. I’ll keep that in mind as I compare with Java.
‘Drill to skill’
At this point, we’re actually doing the drills! Here’s an example of my partially completed series of Koans.
As I complete the drills, I link my own ‘use case’ of understanding how concepts differ from Java. I think this is a better way for learning Kotlin because it’s relevant specifically to me. You’d need to find your own links based on your own goals.
Once I have completed my drills of course, I need to be able to recall them. That’s the final part of the article and we’ll move onto that next.