Slide 1

Slide 1 text

Escape from Java The Java Programming Language™

Slide 2

Slide 2 text

Rob

Slide 3

Slide 3 text

Why Kotlin?

Slide 4

Slide 4 text

Why Kotlin? Less Libraries

Slide 5

Slide 5 text

Why Kotlin? Less Libraries More readability

Slide 6

Slide 6 text

Why Kotlin? Less Libraries More readability Many functions out of the box

Slide 7

Slide 7 text

Why Kotlin? Less Libraries More readability Many functions out of the box

Slide 8

Slide 8 text

False myths

Slide 9

Slide 9 text

False myths Budget

Slide 10

Slide 10 text

False myths Budget Tooling

Slide 11

Slide 11 text

False myths Budget Tooling Learning curve

Slide 12

Slide 12 text

False myths Budget Tooling Learning curve

Slide 13

Slide 13 text

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) {

Slide 14

Slide 14 text

} 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; } }

Slide 15

Slide 15 text

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; } }

Slide 16

Slide 16 text

public class Model { private String property; public String getProperty() { return property; } public void setProperty(String property) { this.property = property; } }

Slide 17

Slide 17 text

public class Model { private final String property; public Model(String property) { this.property = property; } public String getProperty() { return property; } }

Slide 18

Slide 18 text

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; } }

Slide 19

Slide 19 text

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 CREATOR = new Creator() { @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; } }

Slide 20

Slide 20 text

import android.os.Parcelable import kotlinx.android.parcel.Parcelize @Parcelize data class Model(val property: String?) : Parcelable

Slide 21

Slide 21 text

AutoValue Guava Immutables Parceler Annotations

Slide 22

Slide 22 text

GSON uses Reflection

Slide 23

Slide 23 text

GSON uses Reflection Custom TypeAdapters

Slide 24

Slide 24 text

GSON uses Reflection Custom TypeAdapters Vimeo Stag to generate code

Slide 25

Slide 25 text

GSON uses Reflection Custom TypeAdapters Vimeo Stag to generate code Moshi

Slide 26

Slide 26 text

RxJava+ Retrofit

Slide 27

Slide 27 text

Coroutines+ Retrofit

Slide 28

Slide 28 text

Retrofit.Builder() .addCallAdapterFactory(RxJava2CallAdapterFactory.create()) .baseUrl(BuildConfig.API_ENDPOINT) .build()

Slide 29

Slide 29 text

Retrofit.Builder() .addCallAdapterFactory(RxJava2CallAdapterFactory.create()) .baseUrl(BuildConfig.API_ENDPOINT) .build() interface ApiService { @GET("home") fun home(): Single }

Slide 30

Slide 30 text

Retrofit.Builder() .addCallAdapterFactory(CoroutineCallAdapterFactory()) .baseUrl(BuildConfig.API_ENDPOINT) .build()

Slide 31

Slide 31 text

Retrofit.Builder() .addCallAdapterFactory(CoroutineCallAdapterFactory()) .baseUrl(BuildConfig.API_ENDPOINT) .build() interface ApiService { @GET("home") fun home(): Deferred }

Slide 32

Slide 32 text

Coroutines do not replace RxJava

Slide 33

Slide 33 text

Guava

Slide 34

Slide 34 text

Guava Collections getFirst() getLast() concat() addAll() contains() isEmpty() toImmutableList()

Slide 35

Slide 35 text

Guava Collections getFirst() getLast() concat() addAll() contains() isEmpty() toImmutableList() Strings join() split() trim() any() whitespace()

Slide 36

Slide 36 text

Guava Collections getFirst() getLast() concat() addAll() contains() isEmpty() toImmutableList() Strings join() split() trim() any() whitespace() Optionals

Slide 37

Slide 37 text

Guava Collections getFirst() getLast() concat() addAll() contains() isEmpty() toImmutableList() Strings join() split() trim() any() whitespace() Optionals Ranges

Slide 38

Slide 38 text

Guava Collections getFirst() getLast() concat() addAll() contains() isEmpty() toImmutableList() Strings join() split() trim() any() whitespace() Optionals Ranges

Slide 39

Slide 39 text

AutoValue Guava Immutables Parceler Annotations Guava Collections RetroLambda Project Lombok

Slide 40

Slide 40 text

No content

Slide 41

Slide 41 text

open.nytimes.com @nytdev github.com/NYTimes developers.nytimes.com

Slide 42

Slide 42 text

QA &