Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Kotlin Beyond Android: 2019
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Guillermo Orellana
November 25, 2019
Programming
410
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Kotlin Beyond Android: 2019
Guillermo Orellana
November 25, 2019
More Decks by Guillermo Orellana
See All by Guillermo Orellana
All stacks Kotlin
wiyarmir
1
560
Full Stack Kotlin
wiyarmir
2
400
Kotlin beyond Android
wiyarmir
2
340
"Bring your Kotlin to Work" Day
wiyarmir
1
1.6k
Other Decks in Programming
See All in Programming
過去最大のMCPアップデート! 2026-07-28 RC版の謎に迫る
licux
6
460
Vue × Nuxt × Oxc どこまで使える?実運用の現在地
andpad
0
360
1B+ /day規模のログを管理する技術
broadleaf
0
130
Webフレームワークの ベンチマークについて
yusukebe
0
200
「正の参照」と 「負の導出」で組む ハーネスエンジニアリング
cottpan
1
120
キャリア迷子上等 ─ "ない道"は自分で作ればいい
16bitidol
3
2.8k
エンジニア向け会社紹介/Findy Company Profile
findyinc
6
360k
継続モナドとリアクティブプログラミング
yukikurage
3
400
Snowflake Summitでの新機能 CoCo / CoWork / snowflake-summit-2026-overall-what-new-coco
tatsuhiro
1
220
Semantic Version 単位で戦略を柔軟に変えて、パッケージアップデートを自動化する
daitasu
1
340
LLMによるContent Moderationの本番運用の裏側と品質担保への挑戦
suikabar
3
830
エンジニアと一緒にテストコードの設計と実装を改善した話
mototakatsu
0
250
Featured
See All Featured
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
11k
Building the Perfect Custom Keyboard
takai
2
810
My Coaching Mixtape
mlcsv
0
170
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
250
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
1
2.8k
The Limits of Empathy - UXLibs8
cassininazir
1
400
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4.1k
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
560
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.4k
Producing Creativity
orderedlist
PRO
348
40k
How to train your dragon (web standard)
notwaldorf
97
6.7k
Transcript
Kotlin Beyond Android Guillermo Orellana @wiyarmir November 2019 Droidcon San
Francisco
None
We are in the US! And we are hiring in
Los Angeles! Backend, iOS, Android
None
None
None
None
Ctrl+Shift+Alt+K ⌘+⇧+⌥+K
None
None
Backend
None
fun main(args: Array<String>) { embeddedServer(Netty, 8080) { routing { get("/")
{ call.respondText("Hello World") } } }.start() } http://ktor.io/
API Tests #
@Test fun `when userId and password provided then user is
created`() = testApp(mockStorage) { handleRequest(HttpMethod.Post, endpoint) { addHeader( HttpHeaders.ContentType, ContentType.Application.FormUrlEncoded.toString() ) setBody( listOf( "userId" to testId, "password" to testPassword ).formUrlEncode() ) }.apply { assertThat(response.status(), equalTo(HttpStatusCode.Created)) }
Deploying
None
$ git push heroku master
Counting objects: 155, done. Delta compression using up to 36
threads. Compressing objects: 100% (50/50), done. Writing objects: 100% (89/89), 17.45 KiB | 0 bytes/s, done. Total 89 (delta 33), reused 75 (delta 19) remote: -----> Cleaning up!!... remote: -----> Building keynotedex from herokuish!!... remote: -----> Adding BUILD_ENV to build environment!!... remote: -----> Gradle app detected remote: -----> Installing JDK 1.8!!... done remote: -----> Building Gradle app!!... remote: -----> executing ./gradlew stage remote: To honour the JVM settings for this build a new JVM will be forked. Please consider using the daemon: https:!//docs.gradle.org/4.10.2/userguide/gradle_daemon.html. remote: Daemon will be stopped at the end of the build stopping after processing remote: > Task :buildSrc:discoverMainScriptsExtensions remote: > Task :buildSrc:compileKotlin remote: > Task :buildSrc:compileJava NO-SOURCE remote: > Task :buildSrc:compileGroovy NO-SOURCE remote: > Task :buildSrc:processResources NO-SOURCE remote: > Task :buildSrc:classes UP-TO-DATE remote: > Task :buildSrc:inspectClassesForKotlinIC remote: > Task :buildSrc:jar remote: > Task :buildSrc:assemble remote: > Task :buildSrc:discoverTestScriptsExtensions remote: > Task :buildSrc:compileTestKotlin NO-SOURCE remote: > Task :buildSrc:compileTestJava NO-SOURCE remote: > Task :buildSrc:compileTestGroovy NO-SOURCE remote: > Task :buildSrc:processTestResources NO-SOURCE remote: > Task :buildSrc:testClasses UP-TO-DATE remote: > Task :buildSrc:test NO-SOURCE remote: > Task :buildSrc:check UP-TO-DATE remote: > Task :buildSrc:build remote: > Task :backend:clean UP-TO-DATE remote: > Task :backend:discoverMainScriptsExtensions remote: > Task :common:compileJava NO-SOURCE remote: > Task :common:compileKotlinCommon remote: > Task :common:processResources NO-SOURCE remote: > Task :common:classes remote: > Task :common:inspectClassesForKotlinIC remote: > Task :common:jar remote: > Task :common-jvm:discoverMainScriptsExtensions remote: > Task :common-jvm:compileKotlin
remote: > Task :web:runDceKotlinJs remote: > Task :web:compileJava NO-SOURCE remote:
> Task :web:classes remote: > Task :web:compileTestKotlin2Js NO-SOURCE remote: > Task :web:runDceTestKotlinJs NO-SOURCE remote: > Task :web:webpack-config remote: > Task :web:webpack-helper SKIPPED remote: > Task :web:webpack-bundle remote: > Task :web:bundle remote: > Task :web:inspectClassesForKotlinIC remote: > Task :web:jar remote: > Task :web:assemble remote: > Task :web:karma-config SKIPPED remote: > Task :web:karma-run-single SKIPPED remote: > Task :web:compileTestJava NO-SOURCE remote: > Task :web:testClasses UP-TO-DATE remote: > Task :web:test NO-SOURCE remote: > Task :web:check UP-TO-DATE remote: > Task :web:build remote: > Task :backend:copyWebBundle remote: > Task :backend:processReleaseResources remote: > Task :backend:releaseClasses remote: > Task :backend:releaseJar remote: > Task :backend:release remote: > Task :stage remote: remote: Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0. remote: Use '!--warning-mode all' to show the individual deprecation warnings. remote: See https:!//docs.gradle.org/4.10.2/userguide/command_line_interface.html#sec:command_line_warnings remote: remote: BUILD SUCCESSFUL in 9m 8s remote: 32 actionable tasks: 31 executed, 1 up-to-date remote: w: Detected multiple Kotlin daemon sessions at build/kotlin/sessions remote: -----> Discovering process types remote: Procfile declares types !-> web remote: -----> Releasing keynotedex (dokku/keynotedex:latest)!!... remote: -----> Deploying keynotedex (dokku/keynotedex:latest)!!... remote: -----> Attempting to run scripts.dokku.predeploy from app.json (if defined) remote: -----> App Procfile file found (/home/dokku/keynotedex/DOKKU_PROCFILE) remote: -----> DOKKU_SCALE file found (/home/dokku/keynotedex/DOKKU_SCALE) remote: =====> web=1 remote: -----> Attempting pre-!flight checks remote: -----> Attempt 1/5 Waiting for 5 seconds !!...
$ git push origin master $ git push heroku master
None
$ git push origin master
None
None
None
Web
override fun HTML.apply() { head { meta { charset =
"utf-8" } meta { name = "viewport" content = "width=device-width, initial-scale=1.0" } title { insert(caption) } insert(head) } body { div { id = "content" }
override fun HTML.apply() { head { meta { charset =
"utf-8" } meta { name = "viewport" content = "width=device-width, initial-scale=1.0, shrink-to-fit=no" } title { +"Keynotedex" } insert(head) link( rel = LinkRel.stylesheet, type = LinkType.textCss, href = "https:!//maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" ) { attributes["integrity"] = "sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" attributes["crossorigin"] = "anonymous" } } body { div { id = "content" } script(src = "https:!//code.jquery.com/jquery-3.2.1.slim.min.js") { attributes["integrity"] = "sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" attributes["crossorigin"] = "anonymous" } script(src = "https:!//cdnjs.cloud!flare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js") { attributes["integrity"] = "sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" attributes["crossorigin"] = "anonymous" } script(src = "https:!//maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js") { attributes["integrity"] = "sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" attributes["crossorigin"] = "anonymous" } script { insert(bundle) } }
Kotlin JVM kotlinc
https://en.wikipedia.org/wiki/React_(JavaScript_library)
KotlinJS kotlinc-js
window.onload = { document.getElementById("content") .innerHTML = "Hola" }
dynamic
val a: dynamic = 3 a.`types?` .I.`haven't`.heard .that.name.`in`.years = ")"
https://en.wikipedia.org/wiki/React_(JavaScript_library) +
None
None
Kotlin Native kotlinc-native
None
None
None
None
Kotlin Multiplatform
Multiplatform Modules
MyModule
jvmMain androidMain iosMain jsMain commonMain MyModule
jvmMain androidMain iosMain jsMain commonMain jvmTest androidTest iosTest jsTest commonTest
MyModule
jvmMain androidMain iosMain jsMain commonMain MyModule
jvmMain androidMain iosMain jsMain commonMain
expect / actual
jvmMain androidMain iosMain jsMain commonMain MyModule
Multiplatform libraries
@Serializable data class SubmissionResponse( val submission: Submission )
httpClient.submitForm<SignInResponse>( path = Paths.signIn, formParameters = parametersOf( "userId" to listOf(userId),
"password" to listOf(password) ) )
launch { getUserProfile.execute("user1") .fold( { state = Error(it) }, {
state = Content(it) } ) }
Code sharing
Repository Domain Logic Presentation View Binding UI Network
Repository Domain Logic Presentation View Binding UI Network
Repository Domain Logic Presentation View Binding UI Network
The present
$ curl \ https:!//keynotedex.wiyarmir.es/api/v1/conferences/ \ -H 'accept: application/json'
None
None
None
The future
Kotlin 1.3.60 • New Kotlin Native targets • Symbolication of
iOS crashes • Performance • New JS plugin improvements • Multithreaded native coroutines preview
Multiplatform architecture • Don't just share code, share architectural language
• Kotlin Multiplatform an implementation detail
Wrapping up
Is the tech ready?
None
Judge by yourself
https://keynotedex.wiyarmir.es/
wiyarmir/keynotedex
wiyarmir/kotlin-multiplatform-template
Slides: https://speakerdeck.com/wiyarmir/kotlin-beyond-android-2019 Code: github.com/wiyarmir/keynotedex Templates: github.com/wiyarmir/kotlin-multiplatform-template Contact: twitter.com/@wiyarmir