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
Travelling Across Asia - Our Journey from Java ...
Search
Amal Kakaiya
April 23, 2018
Programming
0
30
Travelling Across Asia - Our Journey from Java to Kotlin
Given at Android Makers FR - Paris, 2018
Amal Kakaiya
April 23, 2018
Tweet
Share
More Decks by Amal Kakaiya
See All by Amal Kakaiya
KotlinConf 18 - Learn together. Not the same.
k4kya
0
460
Other Decks in Programming
See All in Programming
Figma Dev Modeで変わる!Flutterの開発体験
watanave
0
130
Streams APIとTCPフロー制御 / Web Streams API and TCP flow control
tasshi
2
350
NSOutlineView何もわからん:( 前編 / I Don't Understand About NSOutlineView :( Pt. 1
usagimaru
0
340
タクシーアプリ『GO』のリアルタイムデータ分析基盤における機械学習サービスの活用
mot_techtalk
4
1.4k
[Do iOS '24] Ship your app on a Friday...and enjoy your weekend!
polpielladev
0
110
CSC509 Lecture 11
javiergs
PRO
0
180
Pinia Colada が実現するスマートな非同期処理
naokihaba
4
230
Ethereum_.pdf
nekomatu
0
460
AWS Lambdaから始まった Serverlessの「熱」とキャリアパス / It started with AWS Lambda Serverless “fever” and career path
seike460
PRO
1
260
ペアーズにおけるAmazon Bedrockを⽤いた障害対応⽀援 ⽣成AIツールの導⼊事例 @ 20241115配信AWSウェビナー登壇
fukubaka0825
6
1.9k
Realtime API 入門
riofujimon
0
150
2024/11/8 関西Kaggler会 2024 #3 / Kaggle Kernel で Gemma 2 × vLLM を動かす。
kohecchi
5
920
Featured
See All Featured
10 Git Anti Patterns You Should be Aware of
lemiorhan
654
59k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
27
4.3k
The Language of Interfaces
destraynor
154
24k
How to train your dragon (web standard)
notwaldorf
88
5.7k
Ruby is Unlike a Banana
tanoku
97
11k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
229
52k
For a Future-Friendly Web
brad_frost
175
9.4k
How To Stay Up To Date on Web Technology
chriscoyier
788
250k
Unsuck your backbone
ammeep
668
57k
Imperfection Machines: The Place of Print at Facebook
scottboms
265
13k
Making Projects Easy
brettharned
115
5.9k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
44
2.2k
Transcript
TRAVELLING ACROSS ASIA OUR JOURNEY FROM JAVA TO KOTLIN Amal
Kakaiya @K4KYA @DeliverooEng
None
DISCLAIMER: COULD TAKE MORE THAN 20 HOURS
Java Kotlin AutoValue/Lombok Data classes Streams support Standard lib functions
Retrolambda Built in lambda support Butterknife Kotterknife/delegate properties # TravellingAcrossAsia @K4KYA
ADOPTING A NEW LANGUAGE IS A HUGE STEP # TravellingAcrossAsia
@K4KYA
TESTS ARE AN EASY WAY TO GET STARTED # TravellingAcrossAsia
@K4KYA
TESTS ARE AN EASY WAY TO GET STARTED BUT NOT
VERY EXCITING # TravellingAcrossAsia @K4KYA
HOW MUCH COULD WE IMPROVE THE MAIN APP? # TravellingAcrossAsia
@K4KYA
None
DON’T GO ROGUE! # TravellingAcrossAsia @K4KYA
KOTLIN HOUR THE MEETING YOU ACTUALLY WANT TO GO TO
# TravellingAcrossAsia @K4KYA
YOU CAN’T START USING A LANGUAGE WITHOUT EVERYBODY KNOWING IT
# TravellingAcrossAsia @K4KYA
DO WE REALLY WANT TO ADD ANOTHER DEPENDENCY? # TravellingAcrossAsia
@K4KYA
None
# TravellingAcrossAsia @K4KYA
# TravellingAcrossAsia @K4KYA
FIND YOUR OWN PACE # TravellingAcrossAsia @K4KYA
None
CONVERT ALL THE THINGS!! # TravellingAcrossAsia @K4KYA
IT WASN’T A SMOOTH RIDE # TravellingAcrossAsia @K4KYA
LEARN FROM EACH OTHER # TravellingAcrossAsia @K4KYA
WE REVIEW CODE EVERY DAY # TravellingAcrossAsia @K4KYA
# TravellingAcrossAsia @K4KYA
ANDROID STUDIO IS YOUR FRIEND # TravellingAcrossAsia @K4KYA
private fun mapToIds(items: List<Item>): List<String> { val ids = mutableListOf<String>()
for (item in items) { ids.add(item.id) } return ids } # TravellingAcrossAsia @K4KYA
private fun mapToIds(items: List<Item>): List<String> { val ids = items.map
{ it.id } return ids } # TravellingAcrossAsia @K4KYA
private fun mapToIds(items: List<Item>): List<String> { return items.map { it.id
} } # TravellingAcrossAsia @K4KYA
private fun mapToIds(items: List<Item>): List<String> = items.map { it.id }
# TravellingAcrossAsia @K4KYA
WHAT’S THIS CODE DOING? # TravellingAcrossAsia @K4KYA
private final mapToId(Ljava/util/List;)Ljava/ util/List; L0 LINENUMBER 2 L0 ALOAD 1
CHECKCAST java/lang/Iterable ASTORE 2 ———————— 75 more lines ———————— # TravellingAcrossAsia @K4KYA
private final List mapToId(List items) { Iterable $receiver$iv = (Iterable)items;
Collection destination$iv$iv = (Collection)(new ArrayList(CollectionsKt.collectionSizeOrDefault($receiver$ iv, 10))); Iterator var5 = $receiver$iv.iterator(); while(var5.hasNext()) { Object item$iv$iv = var5.next(); Item it = (Item)item$iv$iv; String var12 = it.id; destination$iv$iv.add(var12); } return (List)destination$iv$iv; } # TravellingAcrossAsia @K4KYA
EXPECT THE UNEXPECTED # TravellingAcrossAsia @K4KYA
val extraOptions = items .map { "Item $it" } .takeIf
{ showExtraOptions } # TravellingAcrossAsia @K4KYA
Iterable $receiver$iv = (Iterable)items; Collection $receiver$iv = (Collection)(new ArrayList(CollectionsKt.collectionSizeOrDefault($receiver$iv, 10)));
Iterator var8 = $receiver$iv.iterator(); while(var8.hasNext()) { Object item$iv$iv = var8.next(); String it = (String)item$iv$iv; String var17 = "Item " + it; $receiver$iv.add(var17); } List var10000 = (List)$receiver$iv; List extraOptions = showExtraOptions ? var10000 : null; # TravellingAcrossAsia @K4KYA
Iterable $receiver$iv = (Iterable)items; Collection $receiver$iv = (Collection)(new ArrayList(CollectionsKt.collectionSizeOrDefault($receiver$iv, 10)));
Iterator var8 = $receiver$iv.iterator(); while(var8.hasNext()) { Object item$iv$iv = var8.next(); String it = (String)item$iv$iv; String var17 = "Item " + it; $receiver$iv.add(var17); } List var10000 = (List)$receiver$iv; List extraOptions = showExtraOptions ? var10000 : null; # TravellingAcrossAsia @K4KYA
val extraOptions = if (showExtraOptions) items .map { "Item $it"
} else null # TravellingAcrossAsia @K4KYA
CONVERTING CODE # TravellingAcrossAsia @K4KYA
CONVERTING CODE # TravellingAcrossAsia @K4KYA
CONVERTING CODE # TravellingAcrossAsia @K4KYA
CONVERTING CODE ⌘⌥⇧K Ctrl+Alt+⇧+K # TravellingAcrossAsia @K4KYA
CONVERTING CODE # TravellingAcrossAsia @K4KYA
CONVERTING CODE # TravellingAcrossAsia @K4KYA
CONVERTING CODE # TravellingAcrossAsia @K4KYA
CONVERSION CREEP # TravellingAcrossAsia @K4KYA
NULLPOINTEREXCEPTION # TravellingAcrossAsia @K4KYA
NULLPOINTEREXCEPTION # TravellingAcrossAsia @K4KYA
KOTLINNULLPOINTEREXCEPTION # TravellingAcrossAsia @K4KYA
CONSIDER NULLABILITY WHEN IMPLEMENTING A JAVA INTERFACE private val passwordActionListener
= TextView.OnEditorActionListener { _: TextView, _: Int, _: KeyEvent -> login(password()) } # TravellingAcrossAsia @K4KYA
CONSIDER NULLABILITY WHEN IMPLEMENTING A JAVA INTERFACE private val passwordActionListener
= TextView.OnEditorActionListener { _: TextView, _: Int, _: KeyEvent -> login(password()) } # TravellingAcrossAsia @K4KYA
CONSIDER NULLABILITY WHEN IMPLEMENTING A JAVA INTERFACE private val passwordActionListener
= TextView.OnEditorActionListener { _: TextView, _: Int, _: KeyEvent -> login(password()) } # TravellingAcrossAsia @K4KYA
CONSIDER NULLABILITY WHEN IMPLEMENTING A JAVA INTERFACE private val passwordActionListener
= TextView.OnEditorActionListener { _: TextView, _: Int, _: KeyEvent -> login(password()) } # TravellingAcrossAsia @K4KYA
CONSIDER NULLABILITY WHEN IMPLEMENTING A JAVA INTERFACE private val passwordActionListener
= TextView.OnEditorActionListener { _: TextView, _: Int, _: KeyEvent? -> login(password()) } # TravellingAcrossAsia @K4KYA
CONSIDER NULLABILITY WHEN IMPLEMENTING A JAVA INTERFACE private val passwordActionListener
= TextView.OnEditorActionListener { _: TextView, _: Int, _: KeyEvent? -> login(password()) } # TravellingAcrossAsia @K4KYA
CONVERTING CODE class VerifyActivity: BaseActivity<VerifyPresenter>, VerifyScreen { override val message:
String = getString(R.string.verify_error) # TravellingAcrossAsia @K4KYA
CONVERTING CODE class VerifyActivity: BaseActivity<VerifyPresenter>, VerifyScreen { override val message:
String get() = getString(R.string.verify_error) # TravellingAcrossAsia @K4KYA
USE VERSION CONTROL EFFECTIVELY # TravellingAcrossAsia @K4KYA
USE VERSION CONTROL EFFECTIVELY AND YOUR TEAM WILL ❤ YOU
# TravellingAcrossAsia @K4KYA
VERSION HISTORY # TravellingAcrossAsia @K4KYA
VERSION CONTROL CONVERSION AS ONE COMMIT # TravellingAcrossAsia @K4KYA
VERSION CONTROL MERGE CONVERSIONS QUICKLY # TravellingAcrossAsia @K4KYA
VERSION CONTROL # TravellingAcrossAsia @K4KYA
VERSION CONTROL SHARE WHAT YOU LEARNED # TravellingAcrossAsia @K4KYA
SHARE WHAT YOU LEARNED VERSION CONTROL # TravellingAcrossAsia @K4KYA
SHARE WHAT YOU LEARNED VERSION CONTROL # TravellingAcrossAsia @K4KYA
VERSION CONTROL LEAVE IN RETURN TYPES WHEN IT MAKES SENSE
# TravellingAcrossAsia @K4KYA
VERSION CONTROL private fun showPrompt(confirmed: Boolean) = zip(flipper().confirmDrinkingAgeEnabled(), just(confirmed) {
enabled, confirmed -> enabled && (!confirmed) } # TravellingAcrossAsia @K4KYA
VERSION CONTROL private fun showPrompt(confirmed: Boolean): Observable<Boolean> = zip(flipper().confirmDrinkingAgeEnabled(), just(confirmed)
{ enabled, confirmed -> enabled && (!confirmed) } # TravellingAcrossAsia @K4KYA
# TravellingAcrossAsia @K4KYA
ANDROIDANNOTATIONS AUTOVALUE BUTTERKNIFE LOMBOK DAGGER CUSTOM ANNOTATION PROCESSOR # TravellingAcrossAsia
@K4KYA
KAPT KAY - AY - PEE - TEE # TravellingAcrossAsia
@K4KYA
KAPT VS LOMBOK A TRUE STORY # TravellingAcrossAsia @K4KYA
KAPT VS LOMBOK A TRUE STORY # TravellingAcrossAsia @K4KYA
WHAT WOULD WE CHANGE? # TravellingAcrossAsia @K4KYA
CONVERT UTIL CLASSES EARLY # TravellingAcrossAsia @K4KYA
@file:JvmName(“ViewUtils") @JvmName("showView") fun View.show(visible: Boolean) { visibility = if (visible)
VISIBLE else GONE } # TravellingAcrossAsia @K4KYA
DO WHAT WORKS FOR YOUR TEAM # TravellingAcrossAsia @K4KYA
None
THANK YOU WE’RE HIRING Amal Kakaiya @K4KYA