ORMの選び方(Android編)
by
FUJI Goro
Link
Embed
Share
Beginning
This slide
Copy link URL
Copy link URL
Copy iframe embed code
Copy iframe embed code
Copy javascript embed code
Copy javascript embed code
Share
Tweet
Share
Tweet
Slide 1
Slide 1 text
ORMͷબͼํ ~ Androidฤ ~ #potatotips 2016/03/16 @__gfx__
Slide 2
Slide 2 text
ࣗݾհ • Engineer at eBook Initiative Japan • Android Engineer • Recent Works: Android ORM, Static Gson, Robolectric-Instrumentation • rebuild.fm/133 ͰAndroid NͷΛͨ͠
Slide 3
Slide 3 text
No content
Slide 4
Slide 4 text
ORM for Android • ͍·͍ͪϕετϓϥΫςΟε͕ఆ·Βͳ͍ྖҬ • ੲʮ͍͢͞ͷActiveAndroidʯͱʮͷ GreenDAOʯ͘Β͍͔͠બࢶ͕ͳ͔ͬͨ • ࠓ΄͔ʹDBFlow, Requery, OrmaͳͲଟ • NoSQLͷRealmORMػೳΛͭDBͱͯ͠͞Ε ͍ͯΔ
Slide 5
Slide 5 text
ORMʹٻΊΔͷ • : ϦϑϨΫγϣϯ͍ɻίʔυੜ͖͢ • ϚΠάϨʔγϣϯ: ϚΠάϨʔγϣϯ͕ͭΒ͍ͱ ؾܰʹ͑ͳ͍ɻΧϥϜͷՃ͘Β͍ࣗಈͰͬ ͯ͘Ε • ؆୯: ੍Λ՝͞ͳ͍͜ͱʢe.g. ಛఆͷεʔύʔ Ϋϥε͕ඞཁʣɺίʔυิͱͷ૬ੑͷΑ͞
Slide 6
Slide 6 text
• AA: ϦϑϨΫγϣϯ༻ɻ͍ • DBFlow, Orma: ίʔυੜɻ͍ • Realm: ಠࣗDB࣮ɻ͍ ※ ͳ͓Realmߴͱ͍ΘΕΔ͕ɺOrmaDBFlowͱ ͘ΒΔͱʮ͍έʔε͕͋Δʯͱ͍͏ఔ
Slide 7
Slide 7 text
ϚΠάϨʔγϣϯ • खͰϚΠάϨʔγϣϯίʔυΛॻ͖ͨ͘ͳ͍ w ""WFSTJPOTRMʹ42-Λॻ͘ w %#'MPXBEE$PMVNO -POHDMBTT UJNFTUBNQ w 0SNBϦωʔϜҎ֎ίʔυෆཁ w 3FBMNBEE'JFME JE MPOHDMBTT
Slide 8
Slide 8 text
؆୯͞(1): Ϟσϧͷ੍ • ActiveAndroidRealmModelΫϥεΛܧঝ͢Δඞཁ͕͋Γɺ JSON serializeͳͲͰϋϚΔ • AAউखʹprimary keyΛ͚ͭͯϋϚΔ • Orma, Requery੍ͳ͠ɺDBFlowΠϯλʔϑΣΠεͷ࣮ ΛٻΊΔ ※ ҎલͷRelamϞσϧϝιουΛఆٛͰ͖ͳ͍ͳͲͷ੍͕͋ͬ ͕ͨɺv0.88Ͱ΄ͱΜͲղফ͞Εͨ
Slide 9
Slide 9 text
؆୯͞(2): ΫΤϦϏϧμ • ίʔυίϯϓϦʔτͱͷ૬ੑΛߟ͑Δ • ""OFX4FMFDU GSPN *UFNDMBTT XIFSF OBNF +BDL • %#'MPX 42-JUFTFMFDU GSPN *UFNDMBTT XIFSF *UFN@5BCMFOBNFFR +BDL • 0SNBPSNBTFMFDU'SPN*UFN OBNF&R +BDL • 3FBMNSFBMNXIFSF *UFNDMBTT FRVBMT OBNF +BDL
Slide 10
Slide 10 text
݁ • AAΛ͏ཧ༝ͳ͍ • Orma·͋·͋ΠέͯΔ • DBFlowͳ͔ͳ͔Α͍ɻϚΠάϨʔγϣϯ͠ͳ͍ͳ Β • Realm0.88͔Β͍ͩͿΑ͘ͳͬͨɻϚΠάϨʔγϣ ϯ͠ͳ͍ͳΒ
Slide 11
Slide 11 text
OrmaͷΠέͯͳ͍ͱ͜Ζ • ރΕͯͳ͍ʢ։ൃΛ͡Ίͯ3ϲ݄͘Β͍ʣ • ෳࡶͳΫΤϦΛߏஙͰ͖ͳ͍ • has-one, has-many, many-to-manyͳͲͷ associationsͷαϙʔτ͕ශऑ • ίʔυੜܥҰൠͷͱͯ͠ɺίϯύΠϧΤϥʔʹ ͳͬͨͱ͖ʹؔͳ͍Τϥʔ͕େྔʹग़ͯͭΒ͍
Slide 12
Slide 12 text
͓·͚: APK sizes • Normal App: 0.85MiB • Orma App: 0.97MB • Realm App: 5.30MB https://github.com/gfx/ORM-APK-Size-Example
Slide 13
Slide 13 text
https://github.com/gfx/Android-Orma