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
秩序あるKotlinの拡張 / Orderly Kotlin Extensions
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Masatoshi Kubode
June 23, 2021
Programming
1.7k
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
秩序あるKotlinの拡張 / Orderly Kotlin Extensions
https://potatotips.connpass.com/event/214754/
Masatoshi Kubode
June 23, 2021
Transcript
15 slides
©2021 Wantedly, Inc. டং͋ΔKotlinͷ֦ு potatotips #74 2021/06/23 ٱอग़խढ़
©2021 Wantedly, Inc. XXXXBOUFEMZDPNJELVCPEF
©2021 Wantedly, Inc. w JOUFSGBDFͱPCKFDU֦ுؔͰɺ֦ுʹடং ΛͨͤΔ 5-%3
©2021 Wantedly, Inc. ܦҢ
©2021 Wantedly, Inc. w ,..ʹ(SBQI2-Λಋೖ ܦҢ
©2021 Wantedly, Inc. w 3FQPTJUPSZͰϑΣονͨ͠σʔλΛอଘ͍ͨ͠ Γ͍ͨ͜ͱ อଘͨ͠Β GetUseCaseʹ ௨͞ΕΔ
©2021 Wantedly, Inc. w ෳͷGSBHNFOUΛ͏·͘อଘ͍ͨ͠ fragmentͱ • σʔλϞσϧΛஅยԽͨ͠ͷ • ಉ͡ϞσϧΛࢦ͕͢ใྔ͕ҧ͏
• ҰཡͰ࠷খݶ • ৄࡉͰ࠷େݶ Ϟσϧಉ͡ͳͷͰɺ ಉ͡ςʔϒϧʹอଘ͍ͨ͠ Γ͍ͨ͜ͱ fragment ProfileMini on Profile { userId name avatarUrl } fragment ProfileDetail on Profile { userId name avatarUrl coverImageUrl introduction tagline statement # ... all fields }
©2021 Wantedly, Inc. w ECNFSHF GSBHNFOU Έ͍ͨʹॻ͖͍ͨ w 42-%FMJHIUʹࠩΛٵऩͯ͠ɺ͍͍ײ͡ʹอଘ ͢Δػೳͳ͍
Γ͍ͨ͜ͱ
©2021 Wantedly, Inc. w ୯७ʹ֦ுΛॻ͍ͨ Ͳ͏͔ͨ͠ʁ fun Db.merge(fragment: ProfileMiniFragment) {
profilePageQueries.upsertMiniFragment( userId = UserId(fragment.userId), // ... ) }
©2021 Wantedly, Inc. fun Db.merge(fragment: ProfileMiniFragment) { profilePageQueries.upsertMiniFragment( userId
= UserId(fragment.userId), // ... ) } ໊લʹറΓ͕ͳ͍ɺ໎͏ mergeDetail, saveͱ͔ϒϨ͍͢ ҾʹറΓ͕ͳ͍ interfaceͰ੍Λ͍࣋ͨͤͨʂ
ϖʔδλΠτϧ ϖʔδαϒλΠτϧ ©2021 Wantedly, Inc. JOUFSGBDF PCKFDU֦ுؔ
©2021 Wantedly, Inc. PCKFDU֦ுؔ object Foo { fun String.hello() {
println("Hello, $this") } } objectʹ֦ுؔΛ࡞Δ ී௨ͷ֦ுؔͷΑ͏ʹར༻Ͱ͖Δ import Foo.hello fun main() { "World".hello() }
©2021 Wantedly, Inc. ղܾख๏ internal interface Merger<FragmentT> { fun Db.merge(fragment:
FragmentT) } internal object ProfileMiniFragmentMerger : Merger<ProfileMiniFragment> { override fun Db.merge(fragment: ProfileMiniFragment) { profilePageQueries.upsertFragment( userId = UserId(fragment.userId), // ... ) } } // Repository fun fetchMiniList() { val miniList = api.query(GetProfileMiniListQuery()) db.transaction { miniList.forEach { db.merge(it) } } } internal object ProfileDetailFragmentMerger : Merger<ProfileDetailFragment> { override fun Db.merge(fragment: ProfileDetailFragment) { profilePageQueries.upsertFragment( userId = UserId(fragment.userId), // ... ) } } // Repository fun fetchDetail() { val detail = api.query(GetProfileDetailQuery()) db.merge(detail) } ֦ுؔΛ࣋ͭ object࣮ object֦ுؔΛݺΜͰ͍Δ
©2021 Wantedly, Inc. w JOUFSGBDFͱPCKFDU֦ுؔͰɺ֦ுʹடংΛ ͨͤΔ͜ͱ͕Ͱ͖Δ w ࠜຊతʹίʔυੜͱ͔ͰϘΠϥʔϓϨʔτΛ ݮΒ͖͢ʜ ·ͱΊ
ϖʔδλΠτϧ ϖʔδαϒλΠτϧ ©2021 Wantedly, Inc. 🙇
More Decks by Masatoshi Kubode
See All by Masatoshi Kubode
AIチャットの改善から見えた、良いAI体験とは / What Constitutes a Good AI Experience: Insights from Improving AI Chat
kubode
0
250
3リポジトリーを2ヶ月でモノレポ化した話 / How I turned 3 repositories into a monorepo in 2 months
kubode
0
330
ウォンテッドリーの「ココロオドル」モバイル開発 / Wantedly's "kokoro odoru" mobile development
kubode
2
1.4k
Firebase Dynamic Linksの代替手段を自作する / Create your own Firebase Dynamic Links alternative
kubode
0
790
技術を根付かせる / How to make technology take root
kubode
1
550
WantedlyでのKotlin Multiplatformの導入と課題 / Kotlin Multiplatform Implementation and Challenges at Wantedly
kubode
0
710
Google Play Consoleデベロッパー アカウントの確認 / Verifying your Play Console developer account
kubode
1
1.5k
Make your Android app into Multiplatform app
kubode
0
270
ウォンテッドリーにおけるモバイルアプリ開発 / iOSDC Japan 2024 Sponsor Session
kubode
1
1.7k
Other Decks in Programming
See All in Programming
SONY CISC-NEWS NWS-1750 + NWB-225 ハードウェアメンテとフレームバッファカラー対応 / KOF2026
tsutsui
0
140
AI時代のFlutter品質設計 — アプリ品質を守るQuality Layers
omatty198
0
390
Agentic AI with the Power of Jakarta EE
ivargrimstad
0
200
Kawaiicon: Kubernetes, it's no longer cool, but let's secure it anyway!
barnbarn
0
150
React Native経験者が Flutterを30⽇間触って驚いたこと
3saito
0
210
エラーチャンネルのボールを拾い続けて鍛えるエンジニアの地力 / phpcon-niigata2026
meihei3
1
500
特急いなほ as a Workflow / 20261107jaws-festa-2026-akita-lt
kasacchiful
PRO
0
110
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
420
느린 네트워크와 저사양 디바이스 사용자를 위한 웹뷰 로딩 시간 개선기
kmkim
1
270
Going Full Circle with Virtual Graphs and Relational Databases
michaelsimons
1
110
baseline으로 마이그레이션, 리팩토링 안전하게 맡기기
fornewid
1
1.1k
TS 7.0 で baseUrl が使えなくなった今、パスエイリアスをどうするか
bicstone
2
820
Featured
See All Featured
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
23k
Product Roadmaps are Hard
iamctodd
55
13k
The Cult of Friendly URLs
andyhume
79
7.1k
Making Projects Easy
brettharned
120
6.9k
The untapped power of vector embeddings
frankvandijk
2
2k
Are puppies a ranking factor?
jonoalderson
2
4.2k
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
2
360
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
2
2.2k
Documentation Writing (for coders)
carmenintech
77
5.7k
How to make the Groovebox
asonas
2
2.6k
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
The Language of Interfaces
destraynor
162
27k