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
DO NOT REPEAT YOURSELF
Search
Marco Sero
March 13, 2015
Programming
0
310
DO NOT REPEAT YOURSELF
Leverage the power of C++ and Djinni to write native cross platform code on iOS and Android
Marco Sero
March 13, 2015
Tweet
Share
More Decks by Marco Sero
See All by Marco Sero
Working on a Legacy App
marcosero
3
3.1k
Event Detection
marcosero
1
1.6k
Other Decks in Programming
See All in Programming
ファインディLT_ポケモン対戦の定量的分析
fufufukakaka
0
890
バッチを作らなきゃとなったときに考えること
irof
2
470
Pulsar2 を雰囲気で使ってみよう
anoken
0
250
Ruby on cygwin 2025-02
fd0
0
170
『品質』という言葉が嫌いな理由
korimu
0
180
DRFを少しずつ オニオンアーキテクチャに寄せていく DjangoCongress JP 2025
nealle
2
210
Honoをフロントエンドで使う 3つのやり方
yusukebe
7
3.5k
ソフトウェアエンジニアの成長
masuda220
PRO
12
2k
Djangoにおける複数ユーザー種別認証の設計アプローチ@DjangoCongress JP 2025
delhi09
PRO
4
410
Software Architecture
hschwentner
6
2.1k
.NET Frameworkでも汎用ホストが使いたい!
tomokusaba
0
180
Honoのおもしろいミドルウェアをみてみよう
yusukebe
1
220
Featured
See All Featured
It's Worth the Effort
3n
184
28k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
GitHub's CSS Performance
jonrohan
1030
460k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
330
21k
Six Lessons from altMBA
skipperchong
27
3.6k
The Language of Interfaces
destraynor
156
24k
The Cost Of JavaScript in 2023
addyosmani
47
7.3k
Product Roadmaps are Hard
iamctodd
PRO
50
11k
Code Review Best Practice
trishagee
67
18k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
4
420
VelocityConf: Rendering Performance Case Studies
addyosmani
328
24k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
Transcript
DO NOT REPEAT YOURSELF
IOS AND ANDROID HAVE SOMETHING IN COMMON
C++
BUT USING IT... IT'S NOT GREAT
Objective-C++ on iOS JNI (Java Native Interface) on Android
UNTIL...
DJINNI BY
.djinni interface + C++ implementation Djinni JAVA AND OBJECTIVE-C INTERFACES
THE HACK
SHARED C++ IMAGE CACHE
DEFINE INTERFACE IN A .djinni FILE image_cache = interface +c
{ static create_with_path(path: string): image_cache; image_for_key(key: string): binary; save_image_for_key(key: string, image_data: binary); }
IMPLEMENT IT IN C++ shared_ptr<ImageCache> ImageCache::create_with_path(const std::string &path) { ...
} vector<uint8_t> ImageCache::image_for_key(const string &key) { ... } void ImageCache::save_image_for_key(const string &key, const vector<uint8_t> &image_data) { ... }
USE IT FROM OBJECTIVE-C id<YCCPImageCache> imageCache = [YCPPImageCacheCppProxy createWithPath:cachePath]; NSData
*imageData = [imageCache imageForKey:cacheKey]; [imageCache saveImageForKey:cacheKey imageData:imageData]; AND JAVA ImageCache imageCache = ImageCache.createWithPath(cachePath); byte[] imageBlob = this.imageCache.imageForKey(cacheKey); imageCache.saveImageForKey(cacheKey, imageBlob);
NEVER WRITE JNI AND OBJECTIVE-C++ AGAIN
SHARE NATIVE CODE BETWEEN PLATFORMS MORE EASILY
DO I RECOMMEND THIS?
NO AT LEAST FOR OUR APPS
THANK YOU.