Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
コルーチン〜Androidと非同期処理〜
Search
nyafunta9858
November 15, 2022
Programming
860
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
コルーチン〜Androidと非同期処理〜
nyafunta9858
November 15, 2022
Transcript
29 slides
コルーチン〜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
More Decks by nyafunta9858
See All by nyafunta9858
Explicit Backing Field にちょと詳しくなる
nyafunta9858
1
99
AIと一緒にレガシーに向き合ってみた
nyafunta9858
0
960
いまから追い上げる、Jetpack Compose トレーニング
nyafunta9858
1
3.1k
KotlinのLinterまなびなおし2024のホコウ
nyafunta9858
1
190
KotlinのLinter まなびなおし2024
nyafunta9858
4
6.5k
僕らが考える 最強のアーキテクチャについて 腹を割って話そう
nyafunta9858
0
260
もう迷わないCoroutines 〜suspend funとChannelとFlow〜
nyafunta9858
2
7.7k
Other Decks in Programming
See All in Programming
AWS CDKを理解するために公式の定義を深掘って解説してみる / Understanding AWS CDK by Digging into Its Official Definition
akihisaikeda
3
310
作れるエンジニアから、価値を届けるエンジニアへ
ryunakayama
1
310
Getting Started with Vibe Coding
miccheng
0
240
自作Discord音声botをLambda MicroVMsに移行した話 / Migrating My Discord Voice Bot to Lambda MicroVMs
akihisaikeda
1
360
Spec-driven Development with AI
simas
PRO
0
2.3k
Secure Your Coding Agent Like It’s Malware (v1.5) 🇬🇧 @Code.talks 2026
richargh
0
170
React Native에 현대적인 빌드 도구 더하기: Rollipop 구현기
leegeunhyeok
0
180
Snowflake Openflow Connector利用の勘所 / 20261024developersio2026tokyo-snowflake-openflow
kasacchiful
PRO
0
350
オーケストレーション記述言語 Katari
yukikurage
0
270
imagewebp()の向こう側: WebPはなぜ JPEG・PNGより軽いのか
yuzneri
0
120
Apple Intelligenceとオンデバイス時代の到来
yahir0
0
250
baseline으로 마이그레이션, 리팩토링 안전하게 맡기기
fornewid
1
1k
Featured
See All Featured
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
620
エンジニアに許された特別な時間の終わり
watany
109
250k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.7k
WENDY [Excerpt]
tessaabrams
15
41k
Fashionably flexible responsive web design (full day workshop)
malarkey
409
67k
Paper Plane (Part 1)
katiecoart
PRO
3
12k
Designing for Performance
lara
612
70k
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
2
1.7k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
400
Mobile First: as difficult as doing things right
swwweet
225
10k
The Language of Interfaces
destraynor
162
27k