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
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
Webフレームワークの ベンチマークについて
yusukebe
0
200
Developing with AI Agents — Codex, Claude Code & Cowork Practical Guide
x5gtrn
PRO
0
1.3k
AIを活用したE2Eテスト実装効率化のあゆみ / ebisu-mobile-14-kotetu
kotetuco
0
160
AI 輔助遺留系統現代化的經驗分享
jame2408
1
1.2k
ADKを使って簡単にAIエージェントを作ってみよう
k1mu21
0
290
これからAgentCoreを触る方へトレンドはGatewayです
har1101
6
480
AI時代の仕事技芸論〜ソフトウェア開発で「遊ぶように働く」職人的熟達のすすめ(スクフェス仙台 2026バージョン)
kuranuki
0
450
コーディングルールの鮮度を保ちたい for SRE NEXT 2026 / keep-fresh-go-internal-conventions-sre-next-2026
handlename
0
120
Semantic Version 単位で戦略を柔軟に変えて、パッケージアップデートを自動化する
daitasu
1
340
技術記事、 専門家としてのプログラマ、 言語化
mizchi
14
7.3k
コンテキストの使い捨てをやめる — ビジネスルール駆動開発と miko —
ioki
0
270
鹿野さんに聞く!『TypeScriptコードレシピ集』で磨く実践力
tonkotsuboy_com
4
1k
Featured
See All Featured
Crafting Experiences
bethany
1
210
Un-Boring Meetings
codingconduct
0
330
Principles of Awesome APIs and How to Build Them.
keavy
128
18k
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
340
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
Amusing Abliteration
ianozsvald
1
220
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
220
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
230
For a Future-Friendly Web
brad_frost
183
10k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
201
75k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
340
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
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