Kotlin and why should you care about it ?

ME

🇹🇭 Born and bred in BKK, THAILAND

  🗼 Living in Tokyo for 3.5 years

0
 Advanced issue found
â–²
 

  📱 Mobile and Open source, Kotlin, Swift C++ 💖

ME

github.com/kittinunf

@kittinunf

Ok, Kotlin

Statically typed language for JVM, Android, and the browser

Created by Jetbrains back in 2010

Open sourced, hit 1.0 released in Feb 2016 

Seamlessly integrate with IntelliJ platform - also Android Studio

Kotlin ... why?

Inherent Java language restrictions

- Cannot add methods on platform types

- Problem with null

0
 Advanced issue found
â–²
 

- Mutability is everywhere

- Force to evolve everything around Object

Kotlin - Crash course

Null safety Enum class Immutability
Type Inference Properties & Fields Data class
Lambda Extension Functions High order functions
Type-safe builder Collection APIs Kotlin-Java Interoperable

Null Safety

Null Safety

Enum / Sealed class

Mutable/Immutable

Type reference

Properties & Fields

Properties & Fields

Data class

Lambda

Extension Function

High-order function

Type-safe Builder

Rich Collection API


    val a = (1..10) + (1..10)
    
    a.all { it > 0 }                            a.subtract(5..10)
    
    a.any { it % 2 == 0 }                       a.sortedWith { .... } 

    a.average()                                 a.sum()

    a.distinct()                                a.take(3)

    a.dropWhile { it < 5 }                      a.toList()/a.toArrayList()

    a.filterNot { it > 0 }                      a.toSet()/a.toHashSet()

    a.groupBy { if (it < 3) "<3" else ">3" }    a.toCollection(MyAwesomeCollection())
    
    a.intersect(2..4)                           a.toLinkList()

    a.joinToString("-")                         a.toMap({ if (it % 2 == 0) "even" else "odd" }, 
                                                        { it.toString })

    a.max(), a.min()                            a.map { it to it.toString() }.unzip()

    a.none { it < 1 }                           a.withIndex()

    a.reversed()                                a.union(10..20)

    a.sortedBy { it % 3 == 0 }                  a.zip(10..20) 
    

Kotlin - Java Interop

Interop is one of the main target of Kotlin lang.

Add a couple lines of gradle/maven, ready to test

Top-notch intellij support

Versatility

Backend ? - Yes, ktor (https://github.com/Kotlin/ktor)

Frontend ? - Kotlin supports Javascript, see for youself at web-demo

Desktop ? - It is!, take a look at TornadoFx (https://github.com/edvin/tornadofx)

Versatility

iOS developer? No problem! Multi-platform support!! 

Ok? Where to start?

Start with your test code today!!

IF you don't have test?

Wanna know more?

Join our slack channel #learning-kotlin

Hate chatting? f2f meeting every Friday 4-5 pm

I wanna learn with my pace? Fine, you can try https://play.kotlinlang.org/koans/overview

Q & A

Kotlin And Why should you care about it?

By Kittinun Vantasin

Kotlin And Why should you care about it?

  • 725