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
140
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Escape from Java
Slides of the talk I gave at Kotlin Night Torino 2018
Roberto Orgiu
June 08, 2018
More Decks by Roberto Orgiu
See All by Roberto Orgiu
Wellness & Droid
tiwiz
0
140
Behind the curtains
tiwiz
0
87
The Importance of Being Tested
tiwiz
0
450
An Android Dev start to Kotlin MPP
tiwiz
0
210
Fantastic API and where to find them
tiwiz
0
100
Flipping the Koin @ GDG Dev Party
tiwiz
1
79
Flipping the Koin
tiwiz
2
180
Trip into the async world @ NYC Kotlin Meetup
tiwiz
0
130
Trip into the async world
tiwiz
1
150
Other Decks in Programming
See All in Programming
Webフレームワークの ベンチマークについて
yusukebe
0
190
メソッドのジェネリクスでGoの夢は広がるか? / Kyoto.go #65
utgwkk
3
1k
AIで効率化できた業務・日常
ochtum
0
160
Semantic Version 単位で戦略を柔軟に変えて、パッケージアップデートを自動化する
daitasu
1
330
はてなアカウント基盤 State of the Union
cockscomb
1
1.2k
吝嗇家のためのAI活用 / AI development for miser - ChatGPT + Issue Driven Development
tooppoo
0
160
スマートグラスで並列バイブコーディング
hyshu
0
270
エージェンティックRAGにAWSで入門しよう!
har1101
9
1.9k
Vue × Nuxt × Oxc どこまで使える?実運用の現在地
andpad
0
350
気圧・高度・GPSを記録&可視化するアプリ「Koudo」を作った話
hjmkth
1
340
キャリア迷子上等 ─ "ない道"は自分で作ればいい
16bitidol
3
2.7k
20260623_Loop Engineeringで自分の分身の問い合わせBotを作る
ryugen04
0
110
Featured
See All Featured
Thoughts on Productivity
jonyablonski
76
5.2k
Crafting Experiences
bethany
1
200
Unsuck your backbone
ammeep
672
58k
Product Roadmaps are Hard
iamctodd
55
12k
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.2k
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
220
Exploring anti-patterns in Rails
aemeredith
3
430
First, design no harm
axbom
PRO
2
1.2k
How GitHub (no longer) Works
holman
316
150k
Speed Design
sergeychernyshev
33
1.9k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
55k
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
400
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 &