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
Escape from Java
Search
Roberto Orgiu
June 08, 2018
Programming
0
100
Escape from Java
Slides of the talk I gave at Kotlin Night Torino 2018
Roberto Orgiu
June 08, 2018
Tweet
Share
More Decks by Roberto Orgiu
See All by Roberto Orgiu
Wellness & Droid
tiwiz
0
110
Behind the curtains
tiwiz
0
51
The Importance of Being Tested
tiwiz
0
400
An Android Dev start to Kotlin MPP
tiwiz
0
160
Fantastic API and where to find them
tiwiz
0
61
Flipping the Koin @ GDG Dev Party
tiwiz
1
54
Flipping the Koin
tiwiz
2
140
Trip into the async world @ NYC Kotlin Meetup
tiwiz
0
97
Trip into the async world
tiwiz
1
110
Other Decks in Programming
See All in Programming
パッケージ設計の黒魔術/Kyoto.go#63
lufia
3
430
アプリの "かわいい" を支えるアニメーションツールRiveについて
uetyo
0
230
go test -json そして testing.T.Attr / Kyoto.go #63
utgwkk
3
290
速いWebフレームワークを作る
yusukebe
5
1.7k
Processing Gem ベースの、2D レトロゲームエンジンの開発
tokujiros
2
120
Introducing ReActionView: A new ActionView-compatible ERB Engine @ Rails World 2025, Amsterdam
marcoroth
0
680
Ruby×iOSアプリ開発 ~共に歩んだエコシステムの物語~
temoki
0
270
AIと私たちの学習の変化を考える - Claude Codeの学習モードを例に
azukiazusa1
10
3.8k
「待たせ上手」なスケルトンスクリーン、 そのUXの裏側
teamlab
PRO
0
500
奥深くて厄介な「改行」と仲良くなる20分
oguemon
1
520
Compose Multiplatform × AI で作る、次世代アプリ開発支援ツールの設計と実装
thagikura
0
140
250830 IaCの選定~AWS SAMのLambdaをECSに乗り換えたときの備忘録~
east_takumi
0
390
Featured
See All Featured
The Straight Up "How To Draw Better" Workshop
denniskardys
236
140k
The World Runs on Bad Software
bkeepers
PRO
70
11k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
53k
Making Projects Easy
brettharned
117
6.4k
Facilitating Awesome Meetings
lara
55
6.5k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.1k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
15
1.6k
Statistics for Hackers
jakevdp
799
220k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
23
1.4k
Practical Orchestrator
shlominoach
190
11k
Transcript
Escape from Java The Java Programming Language™
Rob
Why Kotlin?
Why Kotlin? Less Libraries
Why Kotlin? Less Libraries More readability
Why Kotlin? Less Libraries More readability Many functions out of
the box
Why Kotlin? Less Libraries More readability Many functions out of
the box
False myths
False myths Budget
False myths Budget Tooling
False myths Budget Tooling Learning curve
False myths Budget Tooling Learning curve
public class Model { private String property; private int anotherProperty;
private float wowAnotherProperty; private double pleaseStahpDude; public String getProperty() { return property; } public void setProperty(String property) { this.property = property; } public int getAnotherProperty() { return anotherProperty; } public void setAnotherProperty(int anotherProperty) {
} public void setAnotherProperty(int anotherProperty) { this.anotherProperty = anotherProperty; }
public float getWowAnotherProperty() { return wowAnotherProperty; } public void setWowAnotherProperty(float wowAnotherProperty) this.wowAnotherProperty = wowAnotherProperty; } public double getPleaseStahpDude() { return pleaseStahpDude; } public void setPleaseStahpDude(double pleaseStahpDude) { this.pleaseStahpDude = pleaseStahpDude; } }
public class Model { private String property; private int anotherProperty;
private float wowAnotherProperty; private double pleaseStahpDude; public String getProperty() { return property; } public void setProperty(String property) { this.property = property; } public int getAnotherProperty() { return anotherProperty; } public void setAnotherProperty(int anotherProperty) { this.anotherProperty = anotherProperty; } public float getWowAnotherProperty() { return wowAnotherProperty; } public void setWowAnotherProperty(float wowAnotherProperty) { this.wowAnotherProperty = wowAnotherProperty; } public double getPleaseStahpDude() { return pleaseStahpDude; } public void setPleaseStahpDude(double pleaseStahpDude) { this.pleaseStahpDude = pleaseStahpDude; } }
public class Model { private String property; public String getProperty()
{ return property; } public void setProperty(String property) { this.property = property; } }
public class Model { private final String property; public Model(String
property) { this.property = property; } public String getProperty() { return property; } }
import android.support.annotation.Nullable; public class Model { private final @Nullable String
property; public Model(@Nullable String property) { this.property = property; } @Nullable public String getProperty() { return property; } }
public class Model implements Parcelable{ private final @Nullable String property;
public Model(@Nullable String property) { this.property = property; } protected Model(Parcel in) { property = in.readString(); } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeString(property); } @Override public int describeContents() { return 0; } public static final Creator<Model> CREATOR = new Creator<Model>() { @Override public Model createFromParcel(Parcel in) { return new Model(in); } @Override public Model[] newArray(int size) { return new Model[size]; } }; @Nullable public String getProperty() { return property; } }
import android.os.Parcelable import kotlinx.android.parcel.Parcelize @Parcelize data class Model(val property: String?)
: Parcelable
AutoValue Guava Immutables Parceler Annotations
GSON uses Reflection
GSON uses Reflection Custom TypeAdapters
GSON uses Reflection Custom TypeAdapters Vimeo Stag to generate code
GSON uses Reflection Custom TypeAdapters Vimeo Stag to generate code
Moshi
RxJava+ Retrofit
Coroutines+ Retrofit
Retrofit.Builder() .addCallAdapterFactory(RxJava2CallAdapterFactory.create()) .baseUrl(BuildConfig.API_ENDPOINT) .build()
Retrofit.Builder() .addCallAdapterFactory(RxJava2CallAdapterFactory.create()) .baseUrl(BuildConfig.API_ENDPOINT) .build() interface ApiService { @GET("home") fun home():
Single<HomeResponse> }
Retrofit.Builder() .addCallAdapterFactory(CoroutineCallAdapterFactory()) .baseUrl(BuildConfig.API_ENDPOINT) .build()
Retrofit.Builder() .addCallAdapterFactory(CoroutineCallAdapterFactory()) .baseUrl(BuildConfig.API_ENDPOINT) .build() interface ApiService { @GET("home") fun home():
Deferred<HomeResponse> }
Coroutines do not replace RxJava
Guava
Guava Collections getFirst() getLast() concat() addAll() contains() isEmpty() toImmutableList()
Guava Collections getFirst() getLast() concat() addAll() contains() isEmpty() toImmutableList() Strings
join() split() trim() any() whitespace()
Guava Collections getFirst() getLast() concat() addAll() contains() isEmpty() toImmutableList() Strings
join() split() trim() any() whitespace() Optionals
Guava Collections getFirst() getLast() concat() addAll() contains() isEmpty() toImmutableList() Strings
join() split() trim() any() whitespace() Optionals Ranges
Guava Collections getFirst() getLast() concat() addAll() contains() isEmpty() toImmutableList() Strings
join() split() trim() any() whitespace() Optionals Ranges
AutoValue Guava Immutables Parceler Annotations Guava Collections RetroLambda Project Lombok
None
open.nytimes.com @nytdev github.com/NYTimes developers.nytimes.com
QA &