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

A Case for Kotlin in Vaadin

A Case for Kotlin in Vaadin

Java, which Vaadin builds upon has been an extremely successful language and platform but it is not without shortcomings. Are some of its potentials locked down because of its legacy? Does Kotlin unlock some of these?
This presentation discusses some of Java's shortcomings and makes a case for Kotlin in Vaadin development by highlighting some of the advantages Kotlin presents.

Sayo Oladeji

May 24, 2018
Tweet

More Decks by Sayo Oladeji

Other Decks in Technology

Transcript

  1. • Java - The Platform (JVM) • Java - The

    Language This thing called Java
  2. • The Java Virtual Machine and its tooling ecosystem •

    Tested, trusted and supported on multiple platforms • Very versatile and successful • Held back by legacy baggage Java - The Platform
  3. • Tightly coupled to Java, the platform • Good, old,

    well known, well tested • Fairly good but not excellent type system • Some not-so-great default behavior (e.g final vs non-final) Java - The Language
  4. • Evolves very slowly • Lacks modern features like coroutines,

    pattern matching, etc • Held back by backward compatibility and legacy baggage Java - The Language
  5. • Strange methods: Objects.requireNonNull, Collections.unmodifiableList, etc • Classes, classes, classes

    everywhere: Optional, BiFunction, Consumer, BiConsumer, TriConsumer, QuadConsumer!! • Many design patterns: singleton, builder, AbstractStaticFactoryProxyProxySingletonB uilder Improving Java
  6. • Static analysis: FindBugs, Sonar, etc • Bytecode enhancements: Lombok,

    etc • New compilers: Eclipse compiler, etc • New JVM languages: Groovy, Scala, Clojure, Ceylon, etc Improving Java
  7. • Clojure is a Lisp. Not a bad thing in

    itself but comes with everything that a lisp is. • Groovy is too flexible for its own good. • Scala is too complex for its own good. • Some of these languages introduce significant footprints and runtime overhead Other JVM Languages
  8. • Designed from the ground up to be simple, flexible

    enough and powerful • Sensible default behaviors • The good path is usually the path of least resistance • High performance and negligible footprint because everything happens at compile time Kotlin to the Rescue
  9. Artifact Size Kilobytes 0 2000 4000 6000 8000 Groovy (v2.4.15)

    Clojure (v1.9.0) Scala (v2.12.5) Kotlin (v1.2.31)
  10. • World class tooling support • Big support from Google,

    Spring, etc • Seamless Java inter-op • Very low entry barrier • Large and helpful community Kotlin to the Rescue
  11. GitHub Stars Stars (thousands) 0 5 10 15 20 25

    Ceylon Groovy Clojure Scala Kotlin
  12. • Kotlin/Vaadin can be tested quickly and reliably with the

    Karibu browserless testing framework (developed by @MartinVysny) • Kotlin targets JS • Kotlin targets Android • Kotlin targets native platforms Additional Benefits
  13. Looking Under the Hood You can view the generated bytecode

    or even decompile it to Java with a click in your IDE
  14. No Language is Perfect • Java is not as bad

    as I might have made it seem • It has a very small surface area and is beginner friendly • It has a lot of tools and libs and resources • It is well tested and trusted • It is now expected to evolve a bit faster with the new release train model • Kotlin isn’t perfect either • Its strong emphasis on Java inter-op might have hindered it a bit • It presents an extra surface area in addition to Java’s • Its debatable whether one can learn to use it effectively as a first language without Java experience
  15. Summary of Kotlin’s Offering • Superior development experience compared to

    Java • Expressive code where intent is not buried in boilerplate • Safety and less chances of bugs • Targets Java, JavaScript, Android and native backends • Easy to get started with • Supported by industry giants and a large community • Excellent Java inter-op • Low adoption risk • Fast and reliable browserless testing
  16. Useful links https://kotlinlang.org https://kotlinlang.org/docs/ kotlin-docs.pdf https://kotlin.link https://kotlin.slack.com https://www.npmjs.com/package/ create-react-kotlin-app Introduction

    to Kotlin Coroutines (Roman Elizarov) Deep Dive into Coroutines on the JVM (Roman Elizarov) Bootiful Kotlin (Josh Long) The Case for Kotlin and Ceylon (Russel Winder) Life is Great and Everything Will be Okay, Kotlin is Here