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
800
1
Share
コルーチン〜Androidと非同期処理〜
nyafunta9858
November 15, 2022
More Decks by nyafunta9858
See All by nyafunta9858
AIと一緒にレガシーに向き合ってみた
nyafunta9858
0
580
いまから追い上げる、Jetpack Compose トレーニング
nyafunta9858
1
2.8k
KotlinのLinterまなびなおし2024のホコウ
nyafunta9858
1
170
KotlinのLinter まなびなおし2024
nyafunta9858
2
6k
僕らが考える 最強のアーキテクチャについて 腹を割って話そう
nyafunta9858
0
230
もう迷わないCoroutines 〜suspend funとChannelとFlow〜
nyafunta9858
2
7.4k
Other Decks in Programming
See All in Programming
Liberating Ruby's Parser from Lexer Hacks
ydah
2
1.2k
VueエンジニアがReactを触って感じた_設計の違い
koukimiura
0
180
HTML-Aware ERB: The Path to Reactive Rendering @ RubyKaigi 2026, Hakodate, Japan
marcoroth
0
140
Vibe NLP for Applied NLP
inesmontani
PRO
0
430
Radical Imagining - LIFT 2025-2027 Policy Agenda
lift1998
0
350
〜バイブコーディングを超えて〜 チームで実験し続けたAI駆動開発
tigertora7571
0
110
AI-DLC Deep Dive
yuukiyo
9
4.2k
Making the RBS Parser Faster
soutaro
0
370
アーキテクチャモダナイゼーションとは何か
nwiizo
19
5.2k
mruby on C#: From VM Implementation to Game Scripting (RubyKaigi 2026)
hadashia
2
490
AWSコミュニティ活動は顧客のクラウド推進に効くのか / Do AWS community activities help customers adopt the cloud?
seike460
PRO
0
140
第3木曜LT会 #28
tinykitten
PRO
0
110
Featured
See All Featured
Statistics for Hackers
jakevdp
799
230k
The World Runs on Bad Software
bkeepers
PRO
72
12k
[RailsConf 2023] Rails as a piece of cake
palkan
59
6.5k
The Limits of Empathy - UXLibs8
cassininazir
1
300
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
1
270
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.6k
YesSQL, Process and Tooling at Scale
rocio
174
15k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
61k
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
340
Principles of Awesome APIs and How to Build Them.
keavy
128
17k
Bash Introduction
62gerente
615
210k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
2.9k
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