Getting started with kotlin

Written by sagarviradiya | Published 2018/02/02
Tech Story Tags: kotlin | started-with-kotlin | software-development | happy-kotling | coding

TLDRvia the TL;DR App

Image Source

I have been learning kotlin since quite a while. Needless to say I love it :) When I started learning it I had no clue from where I should start ? Because of number of resources like videos, official documentation and books. If you haven’t started yet and planning to learn kotlin then I would like share my journey of learning kotlin.

Step 1 : Get your basics clear

To start with you should go through online kotlin’s official documentation. This will teach you about language basics like syntax and other features. Cool thing I like is while reading it you can also edit and run example code snippet within your browser so that you can play around with concept that you have just read.

At first looking at documentation it will be overwhelming. Don’t panic and don’t target to finish entire documentation in one go. Learn piece by piece and once you finish documentation I would recommend again go through it once.

After reading documentation twice you would have rough idea about language and at least you would be able to write hello world in kotlin :)

Reference - Kotlin Programming Language_Once you get an idea of what Kotlin looks like, try solving some Kotlin Koans - interactive programming exercises. If…_kotlinlang.org

Step 2 : Kotlin Koans

After reading documentation it’s time to play around with kotlin. Kotlin koans is programming exercises that you should try. It covers all language features and concepts. It has failing unit tests for each concept, your task is to make it pass. You can try it either online here or you can clone github repo to try in IDE(Intellij IDEA or Android studio). I would recommend cloning github repo and try it in IDE for your future reference of your own solution.

Kotlin koans will push you to think about all concept you read in documentation and apply it while solving exercises. After solving it you would have nice grip on language and feel bit confident. But this doesn’t mean you are done with kotlin. At this point you know the language basics and can write code in kotlin.

Step 3 : Try it in real project

Now it is time to pull up your sleeves and show some action!!!

Side projects are perfect guinea pig for experimenting with new things and learning all consequences that you might face while using it in production. As a android dev I am always occupied with side project. If you are starting something fresh like new side project then it is perfect opportunity to use kotlin in your domain. Using kotlin in side project related to your area of interest will boost your confidence and eventually make you feel safe to use it in production.

At this point you will come across things in kotlin that is specific to your domain (e.g Kotlin Android Extensions for android, Anko is a library providing a set of Kotlin-friendly wrappers around the Android APIs). Trying kotlin in side project not only allow you to evolve your language skills but also gives you opportunity to learn other things that might be helpful if you use it along with kotlin in your domain.

If you don’t have side project to try kotlin then don’t worry. You can still try kotlin if you love to solve programming puzzles (HackerRank, TopCoder etc). I personally got inspired by Dan Lew to improve my kotlin skills by solving puzzles on advent of code (work in progress).

What’s next ?

Learning programming language and writing code in that language is not big deal. What matters is how you write code that is readable to others and at the same time it uses ideal approach of writing code using language features. “Idiomatic kotlin” is the term that best describes above statement and it is not something that you get it quickly. As you keep using it you would come across ideal way to implement something you wrote previously. When you come across situation like this don’t blame yourself. It is perfectly fine to write code in a way you understood language at first. Realizing best approach and refactoring your approach to best approach is the key to idiomatic kotlin. It takes time to master a programming language and kotlin isn’t exception.

Finally I would like to highlight few resources I use to keep up to date with kotlin.

Kotlin Blog_Kotlin - Programming Language by JetBrains_blog.jetbrains.com

Latest Posts_Talking Kotlin is a podcast about Kotlin, a statically typed programming language for the JVM, Android and the browser…_talkingkotlin.com

Kotlin — Antonio Leiva_Find all the Kotlin related content from the blog in a single place. Take a look at the articles and start writing…_antonioleiva.com

Kotlin Weekly_Weekly newsletter about kotlin_www.kotlinweekly.net

Note : These are just few resources I use and there are many more.

You can find me on twitter, G+ and LinkedIn.

That’s it for now folks, happy kotling(coding) ;)


Published by HackerNoon on 2018/02/02