Kotlin
in a real-world project

Anton Rutkevich

JunoLab

Witaj, Kraków!

Hello, Krakow!

Who's out there? :)

About me

  • Android
  • Java, Kotlin, Groovy
  • Gradle, mobile CI

Anton Rutkevich

Based on

6 months of production Android app development

FAQ

or

Why should you care at all?

Kotlin

  • Open source, statically typed JVM language by JetBrains
  • Built with "Effective Java" in mind
  • Good support / community

History

  • Announced in 2011
  • Currently 1.0 Beta 2 (Dec 2015)
  • 1.0 coming soon
  • Bundled with IntelliJ IDEA 15

For Android

  • Native support in Android Studio
  • Strong Android support
  • Java interop is seamless
  • Existing Java libraries can be used
  • < 1Mb library size; ~ 8.5 K Methods

Shut up and take my money method count

Library Size Method count
scala-library-2.11.7 5.7 Mb 50811
groovy-2.4.4 4.6 Mb 28768
kotlin-runtime-1.0.0-beta-2423 231 Kb 1102
kotlin-stdlib-1.0.0-beta-2423 730 Kb 7337

Safety
&
Clean code

Safety

Compile time safety

Compile time safety

Null safety

( Demo 1 )

Easy immutability

( Demo 2 )

Clean code

Higher order functions

( Demo 3 )

Extension functions

( Demo 4 )

Inlined functions

( Demo 5 )

Extension functions
+ RxJava

( Demo 6 )

A lot of other features

  • Inferred types
  • String templates
  • Properties
  • When (upgraded switch)
  • Return if / when / try
  • Ranges
  • Unchecked exceptions
  • Delegates
  • Operator overloading
  • Type-safe builders
  • ...

Downsides

Tooling

  • Compiles a bit slower than Java
  • Android Studio is less smart than with Java
  • No Lint

Code

  • Harder to write hacky tests
  • Must be careful when interacting with Java

Dziękuję!

 

Thank you! 

Question? 

Anton Rutkevich,

Blog: kotlin4android.com

@AntonRutkevich

+AntonRutkevich

anton.rutkevich

  • http://kotlinlang.org
  • Google "Kotlin Koans" - nice Kotlin exercises
  • YouTube "Andrey Breslav - Flexible Types in Kotlin"
  • http://www.slideshare.net/intelliyole/kotlin-why-do-you-care
  • https://slides.com/antonrutkevich/kotlin-real-world-droidcon
Made with Slides.com