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

Kotlin for fullstack web/apps development

A88d9a18fa8d8d5b2b29c5cc3a387931?s=47 Toan Tran
December 18, 2020

Kotlin for fullstack web/apps development

This talk covers the idea of having Kotlin to support in building multiple-component applications. With Kotlin's help, your Backend, Frontend, and Mobile all written in the same language, shares the same business model and domain objects, re-used the business rules and validations.
The talk also comes up with a sample code demonstration to understand how this could be realized.

A88d9a18fa8d8d5b2b29c5cc3a387931?s=128

Toan Tran

December 18, 2020
Tweet

More Decks by Toan Tran

Other Decks in Programming

Transcript

  1. None
  2. About speaker Hello! I’m Toan Kotlin GDE, Android folk @Lazada

    https://toan.mobi toantran-ea toan_mobi
  3. Kotlin for fullstack web/apps development 1. What is Kotlin? (2

    mins ) 2. Why Kotlin? (5 mins ) 3. Kotlin multiple platform to power us (10 mins ) 4. Deep-dive into code to understand KMP (15 mins ) 5. Key-takeaways. (3 mins )
  4. What is Kotlin The Kotlin language project started in 2010

    and soon went open-source
  5. Kotlin evolution v1.0: stable release v1.1: coroutines (experimental ) v1.2:

    Kotlin multiple platforms/Kotlin native (experimental) v1.3: coroutine (stable ) v1.4: Performance improvement
  6. GDG Location Why Kotlin? Expressiveness Safety Interoperability Structured concurrency

  7. class MainActivity : AppCompatActivity () { override fun onCreate(savedInstanceState: Bundle?)

    { ... fab.setOnClickListener { view -> Snackbar.make(view, "Hello ${name.capitalize()}", Snackbar.LENGTH_LONG).show() } fab.backgroundTintList = backgroundTintList } } Why Kotlin?
  8. class MainActivity : AppCompatActivity () { override fun onCreate(savedInstanceState: Bundle?)

    { ... fab.setOnClickListener { view -> Snackbar.make(view, "Hello ${name.capitalize()}", Snackbar.LENGTH_LONG).show() } fab.backgroundTintList = backgroundTintList } } Nullability in the type system Why Kotlin?
  9. class MainActivity : AppCompatActivity () { override fun onCreate(savedInstanceState: Bundle?)

    { ... fab.setOnClickListener { view -> Snackbar.make(view, "Hello ${name.capitalize()}", Snackbar.LENGTH_LONG).show() } fab.backgroundTintList = backgroundTintList } } Nullability in the type system Lambdas Why Kotlin?
  10. class MainActivity : AppCompatActivity () { override fun onCreate(savedInstanceState: Bundle?)

    { ... fab.setOnClickListener { view -> Snackbar.make(view, "Hello ${name.capitalize()}", Snackbar.LENGTH_LONG).show() } fab.backgroundTintList = backgroundTintList } } Nullability in the type system Lambdas Extension functions Why Kotlin?
  11. class MainActivity : AppCompatActivity () { override fun onCreate(savedInstanceState: Bundle?)

    { ... fab.setOnClickListener { view -> Snackbar.make(view, "Hello ${name.capitalize()}", Snackbar.LENGTH_LONG).show() } fab.backgroundTintList = backgroundTintList } } Nullability in the type system Lambdas Template expressions Extension functions Why Kotlin?
  12. class MainActivity : AppCompatActivity () { override fun onCreate(savedInstanceState: Bundle?)

    { ... fab.setOnClickListener { view -> Snackbar.make(view, "Hello ${name.capitalize()}", Snackbar.LENGTH_LONG).show() } fab.backgroundTintList = backgroundTintList } } Nullability in the type system Lambdas Template expressions Extension functions Property access syntax for getters and setters Why Kotlin?
  13. The major usage of Kotlin right now

  14. In my “ideal world” Cross-functional team model

  15. How Kotlin Multiple Platform could help? 1. JVM Code 2.

    JS Code 3. Native Code 4. Common Kotlin
  16. KMP - Common Kotlin 1. The language, core libs, basic

    tools to serve all the platform. 2. Rely on daily-task support tools like Http, serialization, and managing coroutines.
  17. Platform specific version of Kotlin 1. Kotlin/JVM, Kotlin/JS, Kotlin/Native: Platform

    specific libs and tools.
  18. Structure of shared code

  19. Structure of shared code

  20. Structure of shared code

  21. Code demo - Project 1

  22. Code demo - Project 2

  23. Key takeaways 1. Production ready? yes! (KotlinConf 2019: Kotlin in

    Space by Maxim Mazin) 2. Not everything can be shared a. To share: Data, View Model, Validations, Utils, View Model, RPC, Common Libs b. Not to share: UI, Data storage
  24. Key takeaways 3. Where to start? with sample a. Mobile

    KMP: Kotlin Conf app b. JS/JVM: git@github.com:kotlin-hands-on/jvm-js-fullstack.git c. Another one: git@github.com:Kotlin/kotlin-full-stack-application-demo.git 4. Start with step-by-step guide: here
  25. Thank you