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
SOUZOUxMERCARI-A Story of Cute Birds and Oldman
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
jsugai
November 24, 2017
660
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
SOUZOUxMERCARI-A Story of Cute Birds and Oldman
jsugai
November 24, 2017
More Decks by jsugai
See All by jsugai
OsakaMixLeap #11 LT "Star Trek" and "Software development" are similar
jsugai
0
400
Swift <-> Kotlin
jsugai
0
480
Prepare for Android 8.0/GDG-Kobe 2017-09-18
jsugai
0
82
Hashtag
jsugai
1
630
Layout ファイルののメンテナンス
jsugai
1
530
Ho Chi Minh.apk
jsugai
0
53
Umeda.apk 報告会資料
jsugai
1
570
Featured
See All Featured
Skip the Path - Find Your Career Trail
mkilby
1
180
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
3k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
360
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
So, you think you're a good person
axbom
PRO
2
2.1k
New Earth Scene 8
popppiees
3
2.5k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.6k
Principles of Awesome APIs and How to Build Them.
keavy
128
18k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
249
1.3M
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
73
41k
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
Rails Girls Zürich Keynote
gr2m
96
14k
Transcript
͔Θ͍͍খௗΛғ͏ ͓ͬ͞Μୡͷ Mercari, Inc
About me Jun Sugai @calciolife Mercari
Agenda • Welcome Kotlin • Kotlinizing • using Kotlin
Welcome
None
Ͳ͏͍͏ܦҢͰ? Welcome Kotlin/Kotlin ಋೖ
ָͦ͠͏ͳงғؾ͋ͬͨ Welcome Kotlin/Kotlin ಋೖ
•ָͦ͠͏ͳΒͬͯ͠·͏ •໘നͦ͏ͳͬͯ͠·͏ •͕ͳ͚Εڋ൱͠ͳ͍ Welcome Kotlin/Kotlin ಋೖ
Kotlinizing
•ςετίʔυ •Өڹͷগͳ͍ͱ͜Ζ͔Β •৽نͷػೳ͔Β •etc... ABC
•ςετίʔυ •Өڹͷগͳ͍ͱ͜Ζ͔Β •৽نͷػೳ͔Β •etc... ABC શ෦Ͱ͢ΑͶ
ಋೖͬͯײΛॻ͘·ͰΔ ݁ՌΛग़ͯͦ͜͠Ռ ΠλϦΞදͩͬͯϘίϘί
using Kotlin
είʔϓؔ Kotlin ͕Α΄Ͳಛघͳ࣮/࠷దԽͰ ͳ͍ݶΓείʔϓؔཁ͢Δʹ ϝιουΛ࡞ͬͯॲཧΛҠ͔͑͠Δ ίʔυʹࠩ͠ସ͑Δ
None
είʔϓؔ ͏͖ɻReadable ͬͯେࣄɻ
var/val/collection ΞΫηε੍ޚΧϓηϧԽͳͲ Java ΑΓ͔Γ͍͢໘ɺ ଟ༻͢͠͞Ͳ͏ͳΜͩΖ͏?
var/val/collection public class SearchListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { private val List<SearchKeyWord>
dataSet = new ArrayList<>(); public SearchListAdapter(SearchListener listener) { this.listener = listener; } //... @Override public int getItemCount() { return dataSet.size(); } public void setDataSet(List<SearchKeyWord> dataSet) { this.dataSet = dataSet; notifyDataSetChanged(); }
var/val/collection public class SearchListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { private val List<SearchKeyWord>
dataSet = new ArrayList<SearchKeyWord>() //େࣄͳͱ͜Ζ͚ͩ public void setDataSet(List<SearchKeyWord> dataSet) { this.dataSet.clear() this.dataSet.addAll(dataSet) notifyDataSetChanged(); } // Kotlin ͩͱ immutable ʹͨ͘͠ͳͬͪΌ͏
None
var/val/collection private val List<SearchKeyWord> dataSet = new ArrayList<SearchKeyWord>() //େࣄͳͱ͜Ζ͚ͩ public
void setDataSet(List<SearchKeyWord> dataSet) { this.dataSet.clear() this.dataSet.addAll(dataSet) notifyDataSetChanged(); } •clear() -> addAll() ͷྲྀΕ GC ίετతʹͲ͏ͳͷ? •addAll() ͰՃ͢Δࡍͷཁૉ͕ڊେͳ instance ڊେͳ heap ͷࢀরΛอ࣋͢Δߏͩͱ clear() -> adAll() ͚ͩͰ GC ͕ΔՄೳੑ? •ཁૉͷίϐʔΛ࡞Δ heap ίετ/ϑοτϓϦϯτॲཧશମͰແࢹͰ͖Δ΄Ͳখ͍͞?
var/val έʔεʹԠͯ͡ Readable ͳͷେࣄ͚ͩͲϦιʔε༗ݶɻ ύϑΥʔϚϯε "ίʔυͷ࣭" Ͱͳ͘ "ΞϓϦͷ࣭" ͳͷͰಉ͡؍Ͱٞ͠ͳ͍ɻ
ଞͷࣄྫɺ·ͨผͷػձʹ! ใަͱ͔͍ͯͩ͘͠͞