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
コルーチン〜Androidと非同期処理〜
Search
nyafunta9858
November 15, 2022
Programming
820
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
コルーチン〜Androidと非同期処理〜
nyafunta9858
November 15, 2022
More Decks by nyafunta9858
See All by nyafunta9858
AIと一緒にレガシーに向き合ってみた
nyafunta9858
0
690
いまから追い上げる、Jetpack Compose トレーニング
nyafunta9858
1
2.9k
KotlinのLinterまなびなおし2024のホコウ
nyafunta9858
1
170
KotlinのLinter まなびなおし2024
nyafunta9858
2
6.2k
僕らが考える 最強のアーキテクチャについて 腹を割って話そう
nyafunta9858
0
240
もう迷わないCoroutines 〜suspend funとChannelとFlow〜
nyafunta9858
2
7.5k
Other Decks in Programming
See All in Programming
依存関係から依存物へ―Dependencyという言葉の歴史をひも解く
j_lee
0
120
タクシーアプリ『GO』の バックエンド開発のおける AI利活用と若者のすべて
pyama86
3
2k
Creating Composable Callables in Contemporary C++
rollbear
0
130
正しくソフトウェアを作る、前提を疑うための認知の視点 / doubt-premise
minodriven
21
6.6k
AI時代のUIはどこへ行く?その2!
yusukebe
21
7.2k
Spec Driven Development | AI Summit Lisbon
danielsogl
PRO
0
190
Signal Forms: Details & Live Coding @enterJS 2026 in Mannheim
manfredsteyer
PRO
0
130
Oxcを導入して開発体験が向上した話
yug1224
4
310
気づいたらRubyで100作品 ー クリエイティブコーディングが生活の一部になるまで / 100 Ruby Sketches Later: How Creative Coding Became Part of My Life
chobishiba
3
580
エージェンティックRAGにAWSで入門しよう!
har1101
8
1.6k
3Dシーンの圧縮
fadis
1
770
JavaDoc 再入門
nagise
1
350
Featured
See All Featured
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.2k
Darren the Foodie - Storyboard
khoart
PRO
3
3.4k
Chasing Engaging Ingredients in Design
codingconduct
0
220
[SF Ruby Conf 2025] Rails X
palkan
2
1.1k
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.3k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
210
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
610
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.3k
ラッコキーワード サービス紹介資料
rakko
1
3.6M
Art, The Web, and Tiny UX
lynnandtonic
304
22k
Transcript
コルーチン〜Androidと非同期処理〜
小林 慶弘 (Yoshihiro Kobayashi) a.k.a nyafunta9858 • Mobile Engineer •
2010年に組み込みソフトウェア開発を請け負う会社に新 卒で入社。これまでに様々な業種向けのtoC/toBtoCサー ビス開発に従事、ソフトウェア単体で動作するシステム 以外にもBLE機器や車載機をはじめとしたハードウェア 連携を要するシステム開発も多く経験。Androidには2系 の頃から触れ始める。 2022年3月にマネーフォワードへ 参画。ホームカンパニー プロダクト開発部に配属。マ ネーフォワードMEのAndroidアプリ開発を担当。 • 趣味:ガジェット集め、ゲーム、カメラ etc…
今日話すこと • コルーチンとは • コルーチンの推しポイント • まとめ
コルーチンとは • Android で使用できる並行実行のデザインパターン • 非同期実行するコードを簡略化できる • Kotlin 1.3 で追加されたものだが、すでに他の言語で確立されている概念をベースにしている
https://developer.android.com/kotlin/coroutines
今日のテーマについて • Androidの非同期処理は日々使いやすく進化している • コルーチンとの出会い、 1st class サポート • コルーチンの推しポイント
◦ ライフサイクルの考慮が簡単 ◦ スレッド管理・操作がシンプル ◦ 簡潔な記述 ◦ デバッグツール
ライフサイクルの考慮が簡単
ライフサイクル
ライフサイクル 手動でcancelが必要😥
ライフサイクル
ライフサイクル AAC ViewModelなどで使いにくい😥
ライフサイクル
ライフサイクル ライフサイクルに合わせて cancelされる😁
ライフサイクル シンプル + 考えることが 少なくなる👍👍👍
ちなみに...
スレッド管理・操作が シンプル
スレッド管理
スレッド管理 メインスレッドからの呼び出しが必要 😥
スレッド管理
スレッド管理
スレッド管理 CoroutineDispatcherを指定するだけ😁 スレッド管理もおまかせ👍👍👍
簡潔な記述
簡潔な記述
簡潔な記述
簡潔な記述 コード上は同期的 + ネストもなくなり 可読性向上👍👍👍
デバッグツール
デバッグ • kotlinx-coroutines-debug • Coroutine debugger https://www.jetbrains.com/help/idea/debug-kotlin-coroutines.html
まとめ
まとめ • Androidの非同期処理は日々使いやすく進化している • コルーチンとの出会い、 1st class サポート • コルーチンの推しポイント
◦ ライフサイクルの考慮が簡単 ◦ スレッド管理・操作がシンプル ◦ 簡潔な記述 ◦ デバッグツール
Join our team! We’re hiring! https://hrmos.co/pages/moneyforward/job s/0004133