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
なぜ変更を検知できるDBが必要なのか
Search
Shun Hosaka
July 14, 2017
Programming
1
120
なぜ変更を検知できるDBが必要なのか
第4回スタートアップAndroid勉強会 - スタートアップにおけるアーキテクチャとの向き合い方 -の発表資料
Shun Hosaka
July 14, 2017
Tweet
Share
More Decks by Shun Hosaka
See All by Shun Hosaka
Android Goodbye `shape`
reyurnible
0
400
独自設計のAndroidアプリを設計ごとKotlinizeした話
reyurnible
1
1.4k
Kotlin + Kodein Test Data Mocking
reyurnible
1
600
RxDownloader
reyurnible
0
93
Other Decks in Programming
See All in Programming
What We Can Learn From OSS
inouehi
0
420
#phpcon_odawara オープン・クローズドなテストフィクスチャを求めて / open closed test fixtures
77web
3
230
SIMD Parallel Programming with the Vector API
josepaumard
0
180
PHPはいつから死んでいるかの調査
chiroruxx
1
400
⼤規模⾔語モデルの拡張(RAG)が 終わったかも知れない件について
nearme_tech
23
15k
Ruby Function Composition
bkuhlmann
1
330
2 週間で Twitter Bot を作ってみた
contour_gara
0
540
Compose-View Interop in Practice (mDevCamp 2024)
stewemetal
0
140
ONE WEDGE_company_guide
1wedge_one
0
490
初心者のためのRubyKaigi入門/RubyKaigi Introduction
a_matsuda
2
800
Hanami and htmx
bkuhlmann
0
210
Fragment Composition of GraphQL
quramy
7
1k
Featured
See All Featured
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
352
28k
Building Better People: How to give real-time feedback that sticks.
wjessup
355
18k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
2
1.3k
5 minutes of I Can Smell Your CMS
philhawksworth
199
19k
Why You Should Never Use an ORM
jnunemaker
PRO
51
8.6k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
226
51k
Reflections from 52 weeks, 52 projects
jeffersonlam
345
19k
A Tale of Four Properties
chriscoyier
151
22k
How to name files
jennybc
65
93k
Making Projects Easy
brettharned
108
5.5k
The World Runs on Bad Software
bkeepers
PRO
61
6.7k
Principles of Awesome APIs and How to Build Them.
keavy
121
16k
Transcript
ͳͥมߋΛݕͰ͖ΔDB ͕ඞཁͳͷ͔
؆୯ͳࣗݾհ • อࡔ ॣ • ৽ଔҰ • ݸਓࣄۀओ • Twitter:
@Reyurnible • https://github.com/Reyurnible
ࠓɺDBΛͬͯΞϓϦͷΠϕϯ τΩϟογϡΛྑ͘͢Δ͔͠Εͳ ͍
ͦͦɺσʔλϕʔε͍ͬͯ·͢ ͔ʁ
ελʔτΞοϓͱσʔλϕʔε • ࣮ίετ͕ߴ͍ • ϚΠάϨʔγϣϯͱ͔͍͜͠ • APTͰམͪͨΓΑ͘Θ͔Βͳ͍ΤϥʔʹҾ͔͔ͬΓ͕ͪ • εϨουͷ੍ͳͲɺAPIҎ্ʹ໘ •
ϥΠϒϥϦଟͯ͘ͲΕ͕͍͍ͷ͔Θ͔Βͳ͍ -> ͋·Γ࣮ͨ͘͠ͳ͍
σʔλϕʔεΛ࣮͠ͳ͍͚ͯ͘ͳ͍έʔε • ϩʔΧϧͰ࣋ͬͯஔ͔ͳ͚Ε͍͔Ͷ͍ใ͕͋Δ • ͦͦαʔόʔ͕ͳ͍ɺAPI͕ͳ͍
ࠓσʔλϕʔεͰΓ͍ͨ͜ͱ • ը໘ؒͷσʔλอ࣋ • ը໘ؒͷΠϕϯτॲཧ • ը໘෮ؼ࣌ͷσʔλॲཧ • σʔλͷΩϟογϡ ->
Ͳ͏͍ͯ͠·͔͢ʁ
ελʔτΞοϓͩͱ • σβΠϯͰղܾ • ը໘දࣔ͝ͱʹߋ৽ • αϙʔτ͠ͳ͍ -> ࣮͠ͳ͍͍ͯ͘ͷ͕Ұ൪͍͍
ͪΌΜͱαϙʔτΛ͠ͳ͍ͱ͍͚ͳ͘ ͳͬͨ࣌ͷ
ͦͦDBͰͲ͏ղܾ͢Δͷ͔
σʔλϕʔεͰΓ͍ͨ͜ͱ • ΞϓϦͷΩϟογϡ • ຖىಈ͝ͱͷηογϣϯใͷཧ • ΠϕϯτPubSubతͳͭ
DBܥϥΠϒϥϦͷτϨϯυ
ੲ͔Β͋ΔORMϥΠϒϥϦ • SQLite • ActiveAndroid • GreanDAO
࠷ۙͷORMϥΠϒϥϦDB • Room • Realm • Requery • SQL Brite
google / Room • Room provides an abstraction layer over
SQLite to allow fluent database access while harnessing the full power of SQLite • https://developer.android.com/topic/libraries/architecture/ room.html • RxJavaରԠ • LiveDataରԠ
square / SQL Brite • A lightweight wrapper around SQLiteOpenHelper
which introduces reactive stream semantics to SQL operations. • ⭐ 4100 • https://github.com/square/sqlbrite • RxJavaରԠ
realm / Realm • mobile database: a replacement for SQLite
& ORMs • ⭐ 8000 • https://github.com/realm/realm-java • RxJavaରԠ
requery / requery • modern SQL based query & persistence
for Java / Kotlin / Android • ⭐ 2000 • https://github.com/requery/requery • RxJavaରԠ
ײ͍ͯ͡ΔτϨϯυ • RxJavaରԠ • ςʔϒϧͷมߋͷݕ • KotlinରԠ
ςʔϒϧͷมߋΛݕͰ͖ΔDBͱ • INSERT, UPDATE, DELETEͳͲɺσʔλϕʔεʹมߋ͕͋ͬ ͨࡍʹΠϕϯτ௨Λͯ͘͠ΕΔ͜ͱ • RxJavaʹରԠ͍ͯ͠Δ͔͕1ͭͷ伴 -> ͜ΕΛઃܭʹΈࠐΉͱͲ͏ͳΔ͔ɻ
None
None
ίετΛͲ͏͑Δ͔ • LocalSourceͱɺContentProviderΛΦϯϝϞϦͰ࣮͓ͯ͠ ͘ • ୯७ͳBehaviroSubjectLiveDataͳͲ • ͦͷޙɺ༨༟͕Ͱ͖ͨλΠϛϯάͰஔ͖͑Λߦ͏ • ΞϓϦىಈ࣌ʹςʔϒϧͷ༰Λɺશͯഁغ͢Δ
• API͕͋Γɺηογϣϯͷใ͚ͩͰ͍͍߹
·ͱΊΔͱ • ࠷ۙͷDBɺσʔλͷมߋΛݕͰ͖Δ • DBͷ࣮͕ਏ͍߹ɺΦϯϝϞϦʔͰ͍͍ • ͰɺσʔλͷϑϩʔΛม͑ΒΕΔ༨Λ͓ͯ͘͠
ؔ࿈ϦϯΫ • googlesamples/android-architecture • RxJava + FluxʹΑΔAndroidΞϓϦઃܭ • SQLBrite͕ςʔϒϧมߋΛ௨͢ΔΈ