Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Converting Java to Kotlin - Bring your own code

Converting Java to Kotlin - Bring your own code

The presentation that accompanied the workshop at I Code Java '19

Corneil du Plessis

July 24, 2019
Tweet

More Decks by Corneil du Plessis

Other Decks in Programming

Transcript

  1. Agenda • Brief overview of Kotlin • Converting Ping Pong

    TDD – Roman Numerals, more... • Bring your own code. • Questions and Discussions • Java Interoperability • Interesting language features
  2. Kotlin Overview • Improve readability • Reduce cognitive load •

    Functional and Object Oriented • Immutability
  3. Kotlin – Scope functions Name Invocation It / this Lambda

    result or object let receiver.let {} it {} with with(receiver) {} this {} run receiver.run {} this {} apply receiver.apply {} this receiver also receiver.also {} it receiver
  4. Interesting Kotlin features – Java interoperability • @JvmName • @get:JvmName

    • @set:JvmName • @JvmStatic • @JvmField • @JvmOverloads • @JvmDefault • @Throws • @JvmSuppressWildcards • @JvmMultifileClass
  5. Kotlin – Delegated Properties • lazy • Non-Primitives. • notNull

    • Primitives • observable • Lambda is invoked when modified • vetoable • Lambda can prevent an update by returning false
  6. Resources • Kotlin https://kotlinlang.org/ • Kotlin Reference https://kotlinlang.org/docs/reference/ • Kotlin

    Playground https://play.kotlinlang.org/ • Tutorials https://kotlinlang.org/docs/tutorials/ • More https://kotlinlang.org/docs/resources.html • Awesome Kotlin https://kotlin.link/