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
95
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
87
Behind the curtains
tiwiz
0
30
The Importance of Being Tested
tiwiz
0
360
An Android Dev start to Kotlin MPP
tiwiz
0
120
Fantastic API and where to find them
tiwiz
0
44
Flipping the Koin @ GDG Dev Party
tiwiz
1
36
Flipping the Koin
tiwiz
2
130
Trip into the async world @ NYC Kotlin Meetup
tiwiz
0
72
Trip into the async world
tiwiz
1
94
Other Decks in Programming
See All in Programming
非ブラウザランタイムとWeb標準 / Non-Browser Runtimes and Web Standards
petamoriken
0
430
20241217 競争力強化とビジネス価値創出への挑戦:モノタロウのシステムモダナイズ、開発組織の進化と今後の展望
monotaro
PRO
0
290
Fixstars高速化コンテスト2024準優勝解法
eijirou
0
190
良いユニットテストを書こう
mototakatsu
11
3.6k
「とりあえず動く」コードはよい、「読みやすい」コードはもっとよい / Code that 'just works' is good, but code that is 'readable' is even better.
mkmk884
6
1.4k
Simple組み合わせ村から大都会Railsにやってきた俺は / Coming to Rails from the Simple
moznion
3
2.2k
Rubyでつくるパケットキャプチャツール
ydah
0
170
PHPで作るWebSocketサーバー ~リアクティブなアプリケーションを知るために~ / WebSocket Server in PHP - To know reactive applications
seike460
PRO
2
770
HTML/CSS超絶浅い説明
yuki0329
0
190
Lookerは可視化だけじゃない。UIコンポーネントもあるんだ!
ymd65536
1
130
GitHub CopilotでTypeScriptの コード生成するワザップ
starfish719
26
6k
watsonx.ai Dojo #6 継続的なAIアプリ開発と展開
oniak3ibm
PRO
0
170
Featured
See All Featured
Practical Orchestrator
shlominoach
186
10k
Six Lessons from altMBA
skipperchong
27
3.6k
Keith and Marios Guide to Fast Websites
keithpitt
410
22k
We Have a Design System, Now What?
morganepeng
51
7.3k
No one is an island. Learnings from fostering a developers community.
thoeni
19
3.1k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.3k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
Building a Scalable Design System with Sketch
lauravandoore
460
33k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
113
50k
Building Your Own Lightsaber
phodgson
104
6.2k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
10
870
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
3
360
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 &