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

Nice to meet you Kotlin

Gerard
September 04, 2017

Nice to meet you Kotlin

Kotlin has been announced as a first class language for Android developement by Google at the Google I/O 2017. This talk presents Kotlin as a mature and production ready language to migrate all Android projects from Java to Kotlin.

Gerard

September 04, 2017
Tweet

More Decks by Gerard

Other Decks in Programming

Transcript

  1. KOTLIN - Started in mid 2010 - Avoid huge Java

    codebase - Building tools for many languages Presentation
  2. KOTLIN - Started in mid 2010 - Avoid huge Java

    codebase - Building tools for many languages - Want a modern, expressive language Presentation
  3. KOTLIN - Started in mid 2010 - Avoid huge Java

    codebase - Building tools for many languages - Want a modern, expressive language - Easy to introduce in the existing environment Presentation
  4. KOTLIN - Full Java interoperability - Compile as fast as

    Java - More concise than Java Design Goals
  5. KOTLIN - Full Java interoperability - Compile as fast as

    Java - More concise than Java - Prevent more kinds of errors than Java Design Goals
  6. KOTLIN - Full Java interoperability - Compile as fast as

    Java - More concise than Java - Prevent more kinds of errors than Java - Was simpler than Scala Design Goals
  7. WHY USE KOTLIN? - In a future, will replace Java

    as first language - High adoption of the Android community
  8. WHY USE KOTLIN? - In a future, will replace Java

    as first language - High adoption of the Android community - Easy learning for iOS and Android developers
  9. WHY USE KOTLIN? - In a future, will replace Java

    as first language - High adoption of the Android community - Easy learning for iOS and Android developers - Null safety
  10. WHY USE KOTLIN? - In a future, will replace Java

    as first language - High adoption of the Android community - Easy learning for iOS and Android developers - Null safety - Less code is better!
  11. WHY USE KOTLIN? - In a future, will replace Java

    as first language - High adoption of the Android community - Easy learning for iOS and Android developers - Null safety - Less code is better! - Compilation speed
  12. WHAT DOES IT MEANS? - Can create only one project

    for Android and iOS - Back Office can be developed in Kotlin
  13. WHAT DOES IT MEANS? - Can create only one project

    for Android and iOS - Back Office can be developed in Kotlin - Only one language for all projects, all teams
  14. JAVA vs KOTLIN val person: KotlinPerson? = KotlinPerson("John Doe") if

    (person != null) println(person.name) Null safety
  15. JAVA vs KOTLIN public class JavaPerson { private String name;

    public JavaPerson(String name) { this.name = name; } public String getName() { return name; } public void setName(String name) { this.name = name; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; JavaPerson that = (JavaPerson) o; return name != null ? name.equals(that.name) : that.name == null; } @Override public int hashCode() { return name != null ? name.hashCode() : 0; } @Override public String toString() { return "JavaPerson{name='" + name + "'}"; } } Data classes
  16. JAVA vs KOTLIN val person = KotlinPerson("John Doe") println("Name is

    $person") // Use toString function Data classes
  17. JAVA vs KOTLIN fun <K, V> MutableMap<K, V>.getKey(value: V): K

    { return keys.first { get(it) == value } } Extensions
  18. JAVA vs KOTLIN fun <K, V> MutableMap<K, V>.getKey(value: V): K

    { return keys.first { get(it) == value } } val key = map.getKey(value) Extensions
  19. SUMMARY - Kotlin is mature and ready for production -

    Designed to be compatible and better than Java
  20. SUMMARY - Kotlin is mature and ready for production -

    Designed to be compatible and better than Java - Easy to learn and high adoption by the Android community
  21. SUMMARY - Kotlin is mature and ready for production -

    Designed to be compatible and better than Java - Easy to learn and high adoption by the Android community - Compatible with Java, Android, Javascript and soon native!
  22. KOTLIN READY FOR US? - Not ready for iOS project

    - Android applications can migrate to Kotlin right now
  23. KOTLIN READY FOR US? - Not ready for iOS project

    - Android applications can migrate to Kotlin right now - Back-Office to develop? Think to Kotlin, Ktor is there