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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
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
WebRTC映像をAirPlayに対応させる挑戦.pdf
monolithic_adam
0
240
GKE で Pod の見方を変えたら、スケールアウト時の挙動を真に捉えられた話
stkk
0
120
App Storeの外へ──日本のiOSサイドローディング入門 for iOSDC Japan 2026
yuukiw00w
0
210
AI に Inclusive UI を書かせよう — Design Rules Skill で Compose UI を作り直す
theoriatec2024
1
490
自分的「カンファレンスの楽しみ方」
syumai
0
200
AI × TiDD / 2026.09.05 Redmine 大阪
tokudiro
1
170
Are APIs Still Relevant in the AI Era?
soyuka
0
220
Heart of Swift Concurrency
koher
0
720
AWS Step Functions 大規模並列の壁を越える / jaws-sonic-2026-niigata-step-functions
kasacchiful
PRO
1
460
GraphRAGのKnowledge Graphを 直接!見る/View-GraphRAG's-KnowledgeGraph-directly!
tyumugi1113
1
310
モジュールの視点からSwiftを読み解く #iosdc
s_shimotori
0
170
Kiroで創り、AgentCoreで繋ぐ!AWSで実践する「AI-DLC」から「AIエージェント統合」までの最新地図
licux
4
680
Featured
See All Featured
Into the Great Unknown - MozCon
thekraken
41
2.7k
Designing for Performance
lara
611
70k
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
480
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
1
2.9k
AI Search: Where Are We & What Can We Do About It?
aleyda
0
7.9k
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
2
690
Large-scale JavaScript Application Architecture
addyosmani
515
110k
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
740
Color Theory Basics | Prateek | Gurzu
gurzu
1
470
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
1.9k
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
63
46k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
320
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はすごくいい感じ 今回紹介したようなライブラリを使うと、もっといい感じ 面倒事は極力なくして、本質的なロジックの実装に注力したいですね
ありがとうございました