r26D

Resources for Learning Kotlin

I have been programming for a long time. So I don’t have any perspective on how you start with your very first programming language. Instead, I’m just trying to add a new tool to my tool chest, and see if the tool changes how I use other tools I already use.

For a big overview I like to grab a book. It probably seems old-fashioned, but when someone writes a technical book they commit to the topic for a really long time. This often means they give you examples that are more built out. When I first looked at books on Amazon I saw some from my favorites for other languages - namely “Kotlin in Action” and “Head First Kotlin”. Both books are seriously out of date. Old books don’t really surprise me. It is really hard to keep books up to date when the tech underneath them continues to evolve. I imagine it is better to have new versions of a language and old books, then old both.

I was interested in looking at:

  • Functional Programming in Kotlin since that is my preferred paradigm these days.

  • I also saw a very positive review for Kotlin In-Depth - it looks like this used to be two books, and it has been merged into a single updated volume.

  • How to Build Adroid Apps with Kotlin Since Android apps is really my main focus - this is the sort of book that combines the learning while you apply it - which usually results in a better outcome.

I noticed that all the books had very few reviews. I’m going to plunge ahead into the free resources and if I find myself enjoying Kotlin I’ll come back for these.

Since the language was created by JetBrains I figured they might be a good place to start for resources. I found a Learn Kotlin at JetBrain Academy This lead me to a free core Kotlin course that was hosted at HyperSkill.org. I started down the path as was quickly disappointed. The course is free but
very annoying . Basically on the free plan you get the course. You read some content then you take a quiz. You can only answer 10 quiz questions a day. I have completed two days and I’m still at the part of Kotlin training where they explain there is a var,val, and const. This isn’t going to work.

The Kotlin Lang site actually has a good getting started page. You can pick what you are going to do with Kotlin, and they point you from there. I picked Android App, and they offered to send me off to Google (I had already started something there which I’ll link to in a second). They also pointed me at udacity - Developing Android Apps with Kotlin.

On the first page of the course, it has a small message on the first class -

1
2
3
In order to take full advantage of this course, we recommend
that you have fluency in the Kotlin programming language.
If not, you can take our Kotlin Bootcamp for Programmers course.

So of course I continued the yak shave by adding Kotlin Bootcamp for Programmers Course. I haven’t had a chance to start it, so we will see if it is better than the Hyperskill course.

While I was looking at all this I started a simpler course from Google Build Your First Android App in Kotlin. I managed to finish it. It quickly taught me some important things about working in this environment.

  1. Most of my time was spent on laying out the screen and getting things to draw where I want them. The Kotlin part wasn’t going to show up until step 8 of 10.
  2. Versioning of everything matters. When you are starting out in a new environment it is hard to know what is and isn’t important.
    • I got the current version of the Android Studio. When you build a blank activity in that studio the screen fragments are different. Every screen was wrapped in a NestedScrollView. This break every example they give you on how to handle the layout. Since it is part of the basic generator I assume that I should be working with it. Since the example app couldn’t handle it, and I’m still new at this I just did the simplest thing. I deleted the NestedScrollView.
    • The app used a SafeArgs library. The lesson uses 2.3.0-alpha-2. That version is years old. I’m used to having stuff refer to old libs. (Everything is out of date all the time in JavaScript land because people are always pushing new stuff out). No big deal - I’ll just get a newer version. The challenge wasn’t that there was a new library. The challenge was that the way you bring a library into Gradle to build the app has changed significantly since this lesson was written. This was the thing that took the longest to get right since I had so little Gradle experience.

After messing around I got the app to work. I even shared out the version that works now My First Kotlin App. This was simple 10 step lesson with two screens and 4 buttons. There was a hell of a lot of fiddling involved. Now I’m more surprised that React Native worked at all. The amount of stuff they are trying to insulate the developer from is truly mind-boggling.