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
SOUZOUxMERCARI-A Story of Cute Birds and Oldman
Search
jsugai
November 24, 2017
670
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
410
Swift <-> Kotlin
jsugai
0
490
Prepare for Android 8.0/GDG-Kobe 2017-09-18
jsugai
0
83
Hashtag
jsugai
1
630
Layout ファイルののメンテナンス
jsugai
1
530
Ho Chi Minh.apk
jsugai
0
53
Umeda.apk 報告会資料
jsugai
1
570
Featured
See All Featured
BBQ
matthewcrist
89
10k
Code Reviewing Like a Champion
maltzj
528
40k
Leading Effective Engineering Teams in the AI Era
addyosmani
9
2.6k
Prompt Engineering for Job Search
mfonobong
0
450
Ruling the World: When Life Gets Gamed
codingconduct
0
330
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.6k
The agentic SEO stack - context over prompts
schlessera
0
940
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
23k
The Language of Interfaces
destraynor
162
27k
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.6k
Utilizing Notion as your number one productivity tool
mfonobong
4
590
Optimizing for Happiness
mojombo
378
71k
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 ͳͷେࣄ͚ͩͲϦιʔε༗ݶɻ ύϑΥʔϚϯε "ίʔυͷ࣭" Ͱͳ͘ "ΞϓϦͷ࣭" ͳͷͰಉ͡؍Ͱٞ͠ͳ͍ɻ
ଞͷࣄྫɺ·ͨผͷػձʹ! ใަͱ͔͍ͯͩ͘͠͞