Slide 1

Slide 1 text

Kotlin everywhere

Slide 2

Slide 2 text

Who’s speaking Rob @ NYT Boris @ ClearScore 2

Slide 3

Slide 3 text

#CPIT2 sli.do Join the discussion

Slide 4

Slide 4 text

Where https://pusher.com/state-of-kotlin

Slide 5

Slide 5 text

Desktop apps with a little bit of Tornado™

Slide 6

Slide 6 text

● JavaFX ● Beautiful DSL ● UI + Background thread ● Injection ● REST ● Field validation ● Can work™ with JS TornadoFX 6

Slide 7

Slide 7 text

tornadofx.io goo.gl/qSjBPG goo.gl/gcrZss

Slide 8

Slide 8 text

iOS apps and Android (but we wanted the WOW moment)

Slide 9

Slide 9 text

Kotlin Native COMMON no platform specific dependencies class/function declaration 9 PLATFORM implementations of platform-dependent declarations in the common module always an implementation of a single common module REGULAR targets specific platform can be dependency of platform modules can depend on platform modules

Slide 10

Slide 10 text

10

Slide 11

Slide 11 text

◇ common module defines expected declarations ◇ expected declarations never contain any implementation code 11 expected

Slide 12

Slide 12 text

12 actual ◇ platform module provides actual declarations ◇ actual declarations must match expected declarations

Slide 13

Slide 13 text

13 package org.jetbrains.foo expect class Foo(bar: String) { fun frob() } fun main(args: Array) { Foo("Hello").frob() }

Slide 14

Slide 14 text

14 package org.jetbrains.foo actual class Foo actual constructor(val bar: String) { actual fun frob() { println("Frobbing the $bar") } }

Slide 15

Slide 15 text

JVM Backend

Slide 16

Slide 16 text

16

Slide 17

Slide 17 text

Javascript Both Frontend and Backend!

Slide 18

Slide 18 text

18

Slide 19

Slide 19 text

19

Slide 20

Slide 20 text

◇ You can set and call everything you want on properties of this type ◇ Disables compiler checks (beware of runtime errors) 20 dynamic

Slide 21

Slide 21 text

◇ Kotlin assumes the implementation is provided by the developer (in JS) ◇ The compiler will not generate JS code for this function ◇ No auto completion 21 external

Slide 22

Slide 22 text

22 external fun require(module: String): dynamic fun main(args: Array) { val app = require(“express”) app.get(“/hello”, {req, res -> res.send(“Hello world!”) }) }

Slide 23

Slide 23 text

} 23 { Kotlin wrappers

Slide 24

Slide 24 text

24 @JsModule(“express”) external class Express { fun get( route: String, callback: (req: Request, res: Response) -> Unit ) external class Request external class Response { fun send(data: String) } }

Slide 25

Slide 25 text

} 25 { Kotlin wrappers https://github.com/JetBrains/kotlin-wrappers

Slide 26

Slide 26 text

Thanks! Any questions? You can find us at: ◇ @_tiwiz ◇ @borisdamato 26