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
3 libraries you want to keep in mind for realm
Search
daimarom
December 19, 2017
Programming
470
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
3 libraries you want to keep in mind for realm
Realmを導入するなら覚えておきたいライブラリ三選
potatotips#46
https://potatotips.connpass.com/event/73328/
daimarom
December 19, 2017
More Decks by daimarom
See All by daimarom
(Flutterテストの)沼にハマってやってみた
daimarom
2
1.8k
角丸? それxfermodeで出来るよ
daimarom
0
380
Other Decks in Programming
See All in Programming
RSSとCodexを使ってX投稿自動化してみた
ochtum
0
110
初心者DevRelとして参加者だった私が、DevRel Talks!#2に登壇するまでにしてきたこと
sokohirai
0
360
巨大モノリシックアプリ モダン化大作戦
ktcryomm
0
840
思考垂れ流し開発 ~音声入力 × AIエージェント × 開発ハーネスによる試行錯誤~
npostring
0
1.1k
MIZARU@SPAJAM2026 第二回予選
1901drama
0
110
ソフトウェアラスタライザ
fadis
1
800
DroidKaigi 2026 「個人開発という実験場: Android エンジニアが手にする4つの自由」
slashnephy
0
230
型解析で実現する Go の言語内 DSL / Conference に Go! タイムテーブルの歩き方 for Gophers
mazrean
0
140
AIとGame Jamで、ゲームを完成させた話
takahirosaeki
0
120
Can LLMs Replicate 4 Years of Compose Migration? Exploring the boundaries of automation with 279 XML files from a real product
makun
0
130
App Intentsのビルドプロセスを支える技術
kntkymt
0
250
[GoCon2026] When Goroutines Are Not Enough: Runtime Locality in High-Throughput Go
takehaya
6
1.9k
Featured
See All Featured
We Are The Robots
honzajavorek
0
360
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
56
3.5k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.3k
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
2
4.3k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.8k
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
820
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
850
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
Six Lessons from altMBA
skipperchong
29
4.5k
WENDY [Excerpt]
tessaabrams
13
39k
AI: The stuff that nobody shows you
jnunemaker
PRO
9
990
Transcript
Realmを導入するなら 覚えておきたい ライブラリ三選 potatotips#46 2017.12.18
自己紹介 面白法人カヤック / ゲームコミュニティ事業部(Lobi、Lobiトーナメント) 室山大輔 Lobi(※) アプリエンジニア(Android) ※ スマホゲームに特化したSNS
Realm The perfect backend for the next generation of reactive
mobile apps 次世代のリアクティブなモバイルアプリのための完璧なバックエンド APIがシンプルなので、実装がとても楽 とにかく速い(特にquery) 中の人に直接質問できる公式のslackチャンネルがある しかし Realm Java にはちょっと面倒な手続きが…
Realmにおけるモデルクラスの制約 • 引数なしのコンストラクタが必要 • getter, setterが必要だった • 差分アップデートをしたければ、ビルダーを 用意するなりして、自分で何とかする 大抵は
Android Studio が自動生成してくれる 本質的ではないコードを用意するのは少し面倒 モデルクラスが増えれば、更に面倒に public class TestEntity extends RealmObject { @PrimaryKey public String id; public String getId() { return id; } public void setId(String id) { this.id = id; } public TestEntity() { } public TestEntity(String id) { this.id = id; } }
lombok Project Lombok getter/setter, equals/hashCode, toString など ボイラープレートコードをコンパイル時に自動生成 コードがだいぶシンプルになる フィールド名の変更などにも、自動で追従
便利なアノテーションが他にもある(@Builder, @Value など) Javaのプロダクトであれば使える @NoArgsConstructor @AllArgsConstructor @Getter @Setter public class TestEntity extends RealmObject { @PrimaryKey public String id; }
フィールドの指定 Realmは、モデルクラスからスキーマを自動生成する 様々なタイミングでフィールド名(文字列)が必要 マジックストリングを毎度書くのは面倒だし、ミスしそうで怖い そもそも避けたい # クエリ RealmResults<TestEntity> results =
realm.where(TestEntity.class) .equalTo("name", "hoge") .equalTo("child.name", "fuga") .findAll(); # マイグレーション schema.create(TestEntity.class.getSimpleName()) .addField("name", String.class, FieldAttribute.INDEXED) .addField("description", String.class, FieldAttribute.INDEXED) .addRealmObjectField("child", childSchema);
Realm Field Names Helper cmelchior/realmfieldnameshelper フィールド名(文字列)の定数を自動生成 ちょっと面倒なリンククエリ用の定数も生成してくれる # マイグレーション schema.create(TestEntity.class.getSimpleName())
.addField(TestEntityFields.NAME, String.class, FieldAttribute.INDEXED) .addField(TestEntityFields.CHILD.NAME, String.class, FieldAttribute.INDEXED) .addRealmObjectField(TestEntityFields.CHILD.$, childSchema); # クエリ RealmResults<TestEntity> results = realm.where(TestEntity.class) .equalTo(TestEntityFields.NAME, "hoge") .equalTo(TestEntityFields.CHILD.NAME, "fuga") .findAll();
デバッグログ 動作ログ、パフォーマンス計測、ボトルネックの特定、引数・返り値の確認など さまざまな用途でデバッグログの出力が必要 毎回自分で書くのは面倒 ビルドタイプに応じて、ログ出力の有無を 制御しないと、パフォーマンスに影響 public RealmResult<TestEntity> getTest() {
TimingLogger logger = new TimingLogger(TAG, "getTest"); Realm realm = getRealm(); logger.addSplit("get realm"); RealmResults<TestEntity> results = realm.where(TestEntity.class) .equalTo(TestEntityFields.NAME, "hoge") .equalTo(TestEntityFields.CHILD.NAME, "fuga") .findAll(); logger.addSplit("get test"); logger.dumpToLog(); return result; }
Hugo JakeWharton/hugo メソッドの引数・返り値、実行時間を自動出力 デバッグビルドの場合のみ出力 @DebugLog public RealmResult<TestEntity> getTest() { Realm
realm = getRealm(); RealmResults<TestEntity> results = realm.where(TestEntity.class) .equalTo(TestEntityFields.NAME, "hoge") .equalTo(TestEntityFields.CHILD.NAME, "fuga") .findAll(); return result; } # logcat V/TestProviderImpl: ⇢ getTest() V/TestProviderImpl: ⇠ getTest [2ms] = []
まとめ Realmはすごくいい感じ 今回紹介したようなライブラリを使うと、もっといい感じ 面倒事は極力なくして、本質的なロジックの実装に注力したいですね
ありがとうございました