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

Kotlin

 Kotlin

Avatar for Vyacheslav Artemyev

Vyacheslav Artemyev

October 03, 2018

Other Decks in Programming

Transcript

  1. • Statically typed programming language • A variety of tools

    around it • It’s a stable, very capable platform • The JVM with JIT is fast enough for just about anything • Being a garbage collected language means there is a whole class of problems I can ignore Things that make me like Java and JVM
  2. Things that make me dislike Java • It’s very verbose

    and repetitive • Boilerplate • Everything is a nail (class) • A Nullability problem • Checked exceptions
  3. What is Kotlin? • Statically typed programming language developed by

    JetBrains (IntelliJ) • Open sourced in 2011, Kotlin 1.0 released on Feb 15th of 2016 • 100% interoperable with Java • On Google I/O 2017 became first class citizen language on Android
  4. Why Kotlin? • Costs nothing to adopt • Concise language

    • No runtime overhead • Solves the Nullability problem • Great Interoperability • Familiar syntax • Lots of modern features
  5. Lots of modern features • Null safety • No checked

    exceptions • Extension functions • High-order functions • Function types & lambdas • Default & named arguments • Properties • Type inference • Operator overloading • Smart casts • Data classes • Immutable collections • Enhanced switch-case • String interpolation • Ranges • Inline functions • Infix notations • Tail recursion • Coroutines (async/await) from 1.3 • Great Standard Library
  6. Lots of modern features • Null safety • No checked

    exceptions • Extension functions • High-order functions • Function types & lambdas • Default & named arguments • Properties • Type inference • Operator overloading • Smart casts • Data classes • Immutable collections • Enhanced switch-case • String interpolation • Ranges • Inline functions • Infix notations • Tail recursion • Coroutines (async/await) from 1.3 • Great Standard Library • 100% Java interoperable • Similar syntax • Great community • Compiles to Java 6 bytecode • Great tooling • Rapid development
  7. What Java has that Kotlin doesn’t • Checked exceptions •

    Primitive types that are not classes • Static members • Non-private fields • Wildcard-types • Ternary-operator a ? b : c
  8. Kotlin and Spring Kotlin: 
 By default, all classes and

    methods are final Spring: • @Configuration doesn’t work • Proxy can’t be created Kotlin: • Write open everywhere • Take a look at the plugins: all-open or kotlin-spring
  9. • Nullability support in Spring: jira.spring.io/browse/SPR-15540 (closed) • @NonNullApi, @NonNullFields,

    etc. (JSR-305) • Reactor, Spring-Data-Mongo, Spring-Data-Cassandra with null-safety support Kotlin, Spring and null
  10. Kotlin JS Scenarios for compiling Kotlin to JS: • Creating

    Kotlin code that targets client-side JS: • Interacting with DOM elements • Interacting with graphics such as WebGL • Creating Kotlin code that targets server-side JS: • Working with server-side technology (Node.js) kotlinlang.org/docs/reference/js-overview.html
  11. Kotlin Native Target platforms: • Windows (x86_64 only at the

    moment) • Linux (x86_64, arm32, MIPS, MIPS little endian) • MacOS (x86_64) • iOS (arm32 and arm64) • Android (arm32 and arm64) • WebAssambly (wasm32 only) github.com/JetBrains/kotlin-native/tree/master/samples
  12. How to start? • Kotlin homepage and documentation: kotlinlang.org •

    Slack: kotlinlang.slack.com • Kotlin links: kotlin.link • KEEP: https://github.com/Kotlin/KEEP • Kotlin weekly: www.kotlinweekly.net