Slide 1

Slide 1 text

!

Slide 2

Slide 2 text

! ā€œā€¦Kotlin is a new JVM languageā€¦ā€

Slide 3

Slide 3 text

! ā€œā€¦Kotlin is a new JVM languageā€¦ā€

Slide 4

Slide 4 text

! ā€œā€¦Kotlin is a new JVM languageā€¦ā€

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

made by JetBrains open source, non-proļ¬t foundation pragmatic safe(r than Java) ā€œgoodā€ magic āœØ FUN

Slide 8

Slide 8 text

packages optional no need to match folder ļ¬les multiple classes top level functions

Slide 9

Slide 9 text

// src/main/kotlin/covfefe/Whatever.kt fun main(args: Array) { } println("Hello World!")

Slide 10

Slide 10 text

fun main(args: Array) { val immutable = 0 immutable += 1 }

Slide 11

Slide 11 text

fun main(args: Array) { var mutable = 0 mutable += 1 }

Slide 12

Slide 12 text

fun main(args: Array) { val nullable: String? = null val alternative = nullable ?: "ĀÆ\_(Ļ‘)_/ĀÆ" val lengthOrNull = nullable?.length if (nullable != null) { println(nullable.length) } } }

Slide 13

Slide 13 text

fun Int.twice() = this * 2 fun test() = 1.twice() // 2

Slide 14

Slide 14 text

inline fun Map.getOrElse( key: K, defaultValue: () -> V ) = get(key) ?: defaultValue()

Slide 15

Slide 15 text

abstract class NetworkResult { object Cancelled : NetworkResult() data class Success(val json: String) : NetworkResult() data class Error(val error: Throwable) : NetworkResult() } fun test(result : NetworkResult) = when (result) { NetworkResult.Cancelled -> null is NetworkResult.Success -> result.json is NetworkResult.Error -> throw result.error else -> error("WTF") }

Slide 16

Slide 16 text

sealed object Cancelled : NetworkResult() data class Success(val json: String) : NetworkResult() data class Error(val error: Throwable) : NetworkResult() } fun test(result : NetworkResult) = when (result) { NetworkResult.Cancelled -> null is NetworkResult.Success -> result.json is NetworkResult.Error -> throw result.error class NetworkResult { }

Slide 17

Slide 17 text

why?

Slide 18

Slide 18 text

everything you can do in Kotlin can be done in Java

Slide 19

Slide 19 text

everything you can do in Java can be done in bytecode

Slide 20

Slide 20 text

high level abstractions, enforced by the compiler extend the language through DSL built in symbiosis with tools moving fast, but carefully change of mindset

Slide 21

Slide 21 text

myths

Slide 22

Slide 22 text

slow compilation runtime overhead learning curve not knowing whatā€™s really going on confusing without IDE

Slide 23

Slide 23 text

cons

Slide 24

Slide 24 text

occasional rough edges around tooling not being able to go back to Java, ever

Slide 25

Slide 25 text

future

Slide 26

Slide 26 text

immutable collections universal serialization type classes multiplatform metaprogramming

Slide 27

Slide 27 text

Ofļ¬cial website goo.gl/xL99fk Kotlin and Android (blog) goo.gl/FQYAcW Introduction to Kotlin (video) goo.gl/3n6wic Life is Great and Everything Will Be Ok, Kotlin is Here (video) goo.gl/NTaYqi Using Project Kotlin for Android (doc) goo.gl/T0SDTJ The Future of Kotlin (video) goo.gl/INLPDl Kotlin 1.1 (video) goo.gl/iKojmn

Slide 28

Slide 28 text

BIT .LY /KO TLIN -M O RE -TH A N -A N -ISLA N D Eugenio Marletti @workingkills