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
Kotlin & Modern Libraries
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Takuji Nishibayashi
February 24, 2016
Technology
310
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Kotlin & Modern Libraries
Takuji Nishibayashi
February 24, 2016
More Decks by Takuji Nishibayashi
See All by Takuji Nishibayashi
compose-hot-reload を試そうとした話
takuji31
0
160
CameraX使ってみた
takuji31
0
310
kotlinx.datetime 使ってみた
takuji31
0
1.1k
HiltのCustom Componentについて
takuji31
0
380
java.timeをAndroidで使う
takuji31
0
200
KSPを使ってコード生成
takuji31
0
470
Kotlin Symbol Processing API (KSP) を使って Kotlin ア プリケーションの開発を効率化する
takuji31
1
3.2k
kotlinx.serialization
takuji31
0
690
kanmoba-returns-02.pdf
takuji31
0
290
Other Decks in Technology
See All in Technology
徹底討論!ECS vs EKS!
daitak
3
1.8k
Comment regagner la souveraineté de vos données tout en étant payé grâce à Nostr !
rlifchitz
0
220
時期が悪い!それでもRaspberry Piを買って遊んで活用するには / 20260627-osc26do-rpi-jikigawarui
akkiesoft
1
900
IaC コードを資産へ:AWS CDK 社内ライブラリと横断展開 / aws-summit-japan-2026
gotok365
10
1.6k
AI Agentをシステムに組み込む前にゆるく向き合ってみる
hayama17
0
170
AIに障害切り分けを全部やってもらった。 。 。 。
estie
0
260
toB プロダクトから見たWAF
tokai235
0
250
「勝手に広まる」人気 AI エージェントを爆速で作ろう!(AWS Summit Japan 2026講演資料)
minorun365
PRO
10
2.6k
4人目のSREはAgent
tanimuyk
0
280
サイバーエージェントにおけるAI推進戦略と変革への取り組み
shotatsuge
0
610
10年間のブログ発信を振り返って見えたWebアプリケーションエンジニアとしての軌跡
stefafafan
0
190
Docker Desktop不要の時代が来る? WSL標準の「wslc」で Linuxコンテナを動かしてみた.
ueponx
0
120
Featured
See All Featured
The agentic SEO stack - context over prompts
schlessera
0
830
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
Visualization
eitanlees
152
17k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
201
75k
HTML-Aware ERB: The Path to Reactive Rendering @ RubyCon 2026, Rimini, Italy
marcoroth
2
250
Being A Developer After 40
akosma
91
590k
Automating Front-end Workflow
addyosmani
1370
210k
BBQ
matthewcrist
89
10k
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
2
1.5k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
950
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
870
Transcript
Kotlin & modern libraries @takuji31
@takuji31 (Takuji Nishibayashi) Application Engineer at Hatena
Loves (AVG 160)
Loves Kotlin
Kotlin
Kotlin 1.0.0 released
JVM Language by JetBrains
Like Swift syntax
Like Swift syntax Swift is Kotlin like syntax!
Java Interoperability
Less boilerplate code
Android ready
Pretty name
Kotlin + modern libraries = happy
Dagger2
Provides in module constructor
Java @Module public class AppModule { private final Context context;
public AppModule(Context context) { this.context = context; } @Provides public Context context() { return context; } @Provides public NotificationManager notificationManager(Context context) { return (NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE); } }
Kotlin (Provider methods) @Module class AppModule( val context: Context )
{ @Provides fun context() : Context = context @Provides fun notificationManager(context: Context) : NotificationManager = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager }
Use property
Kotlin (Constructor property) @Module class AppModule( @get:Provides val context: Context
) { @Provides fun notificationManager(context: Context) : NotificationManager = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager }
Kotlin (Constructor property) @Module class AppModule( @get:Provides val context: Context,
@get:Provides val notificationManager: NotificationManager = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager ) { }
Provides in component property
Java @Component(modules = AppModule.class) @Singleton public interface AppComponent { Context
context(); NotificationManager notificationManager(); }
Kotlin (functions) @Singleton @Component(modules = arrayOf(AppModule::class)) interface AppComponent { fun
context(): Context fun notificationManager(): NotificationManager }
Use property
Kotlin (properties) @Singleton @Component(modules = arrayOf(AppModule::class)) interface AppComponent { val
context : Context val notificationManager : NotificationManager }
Realm
Constructor and properties
Primary constructor and default value
Java public class User extends RealmObject { @PrimaryKey private String
uuid; private String name; public User() { this(UUID.randomUUID().toString(), null); } public User(String uuid, String name) { this.uuid = uuid; this.name = name; } public String getUuid() {return uuid;} public void setUuid(String uuid) {this.uuid = uuid;} public String getName() {return name;} public void setName(String name) {this.name = name;} }
Kotlin (default constructor) class User constructor() : RealmObject() { @PrimaryKey
var uuid: String? = UUID.randomUUID().toString() var name: String? = null }
Kotlin (with default value) open class User( @PrimaryKey open var
uuid: String = UUID.randomUUID().toString(), open var name: String? = null ) : RealmObject() {}
Computed property in model class
Use extension property
Java public class User extends RealmObject { private Date createdDate;
@Ignore private Instant createdAt; public Date getCreatedDate() {return createdDate;} public void setCreatedDate(Date createdDate) {this.createdDate = createdDate;} public Instant getCreatedAt() { return DateTimeUtils.toInstant(getCreatedDate()); } public void setCreatedAt(Instant createdAt) { setCreatedDate(DateTimeUtils.toDate(createdAt)); } }
Kotlin (property) Not available
Kotlin (extension property) open class User( … open var createdDate:
Date? = null ) : RealmObject() {} var User.createdAt : Instant get() = DateTimeUtils.toInstant(createdDate) set(value) { createdDate = DateTimeUtils.toDate(value) }
Enjoy Kotlin life!