Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥
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
83
Behind the curtains
tiwiz
0
27
The Importance of Being Tested
tiwiz
0
350
An Android Dev start to Kotlin MPP
tiwiz
0
120
Fantastic API and where to find them
tiwiz
0
41
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
69
Trip into the async world
tiwiz
1
91
Other Decks in Programming
See All in Programming
事業成長を爆速で進めてきたプロダクトエンジニアたちの成功談・失敗談
nealle
3
1.1k
subpath importsで始めるモック生活
10tera
0
390
Jakarta EE meets AI
ivargrimstad
0
530
距離関数を極める! / SESSIONS 2024
gam0022
0
360
Figma Dev Modeで変わる!Flutterの開発体験
watanave
0
3.7k
macOS なしで iOS アプリを開発する(※ただし xxx に限る)
mitsuharu
1
160
気をつけたい!Desktop対応で陥りやすい罠とその対策
goto_tsl
0
180
[KR] Open-Source Ecosystems
skydoves
0
110
大規模サイトリビルドの現場から:成功と失敗のリアルな教訓 / Site Rebuild,Real Lessons Learned from Successes and Failures_JJUG Fall 2024
techtekt
0
200
ペアーズにおけるAmazon Bedrockを⽤いた障害対応⽀援 ⽣成AIツールの導⼊事例 @ 20241115配信AWSウェビナー登壇
fukubaka0825
6
2.3k
似たもの同士のPerlとPHP
uzulla
1
110
新規学習のハードルを下げる方法とは?/ How to Make Learning Something New Easier?
nobuoooo
1
130
Featured
See All Featured
The Invisible Side of Design
smashingmag
298
50k
BBQ
matthewcrist
85
9.3k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
6.8k
A Modern Web Designer's Workflow
chriscoyier
693
190k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
27
2.1k
How To Stay Up To Date on Web Technology
chriscoyier
789
250k
Large-scale JavaScript Application Architecture
addyosmani
510
110k
What's in a price? How to price your products and services
michaelherold
243
12k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
132
33k
Embracing the Ebb and Flow
colly
84
4.5k
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 &