Slide 1

Slide 1 text

Getting to 100% Kotlin: A practical guide [email protected] @dankim

Slide 2

Slide 2 text

Why was Kotlin important to us?

Slide 3

Slide 3 text

It made me happy!

Slide 4

Slide 4 text

Running headfirst into the unknown

Slide 5

Slide 5 text

Learn the language (and ship)

Slide 6

Slide 6 text

Convert our backlog of Java (and ship)

Slide 7

Slide 7 text

What pitfalls should we watch out for?

Slide 8

Slide 8 text

✅ Practical, low-stress strategies

Slide 9

Slide 9 text

Get real with production code

Slide 10

Slide 10 text

Start with small conversions

Slide 11

Slide 11 text

No tests!

Slide 12

Slide 12 text

Getting excited is important!

Slide 13

Slide 13 text

Start with small conversions

Slide 14

Slide 14 text

Start with small conversions ✅ POJOs / Models

Slide 15

Slide 15 text

Start with small conversions ✅ POJOs / Models ✅ Util methods

Slide 16

Slide 16 text

Start with small conversions ✅ Adapters ✅ POJOs / Models ✅ Util methods

Slide 17

Slide 17 text

Start with small conversions ✅ Adapters ✅ POJOs / Models ✅ Util methods Entire Retrofit implementation

Slide 18

Slide 18 text

Forget about being perfect

Slide 19

Slide 19 text

✌Idiomatic Kotlin✌

Slide 20

Slide 20 text

Don’t get too caught up in it

Slide 21

Slide 21 text

Find yourself in some serious rabbit holes

Slide 22

Slide 22 text

fun processAccounts(accounts: List?) {
 for (account in accounts!!) {
 if (account.active) {
 ...
 } else if (account.trial) {
 ...
 } else {
 ...
 }
 }
 }

Slide 23

Slide 23 text

fun processAccounts(accounts: List?) {
 for (account in accounts!!) {
 if (account.active) {
 ...
 } else if (account.trial) {
 ...
 } else {
 ...
 }
 }
 }

Slide 24

Slide 24 text

fun processAccounts(accounts: List?) {
 for (account in accounts!!) {
 if (account.active) {
 ...
 } else if (account.trial) {
 ...
 } else {
 ...
 }
 }
 }

Slide 25

Slide 25 text

fun processAccounts(accounts: List?) {
 for (account in accounts!!) {
 if (account.active) {
 ...
 } else if (account.trial) {
 ...
 } else {
 ...
 }
 }
 }

Slide 26

Slide 26 text

fun processAccounts(accounts: List?) {
 for (account in accounts!!) {
 if (account.active) {
 ...
 } else if (account.trial) {
 ...
 } else {
 ...
 }
 }
 }

Slide 27

Slide 27 text

fun processAccounts(accounts: List?) {
 for (account in accounts!!) {
 if (account.active) {
 ...
 } else if (account.trial) {
 ...
 } else {
 ...
 }
 }
 }

Slide 28

Slide 28 text

fun processAccounts(accounts: List?) {
 for (account in accounts!!) {
 if (account.active) {
 ...
 } else if (account.trial) {
 ...
 } else {
 ...
 }
 }
 }

Slide 29

Slide 29 text

Find a few key concepts that click *for you*

Slide 30

Slide 30 text

Find a few key concepts that click *for you*

Slide 31

Slide 31 text

Find a few key concepts that click *for you* ✅ Flow control

Slide 32

Slide 32 text

Find a few key concepts that click *for you* ✅ Flow control ✅ Collections

Slide 33

Slide 33 text

Find a few key concepts that click *for you* ✅ Flow control ✅ Collections ✅ Extension functions

Slide 34

Slide 34 text

The auto converter is your friend

Slide 35

Slide 35 text

Side by side learning

Slide 36

Slide 36 text

You’re only ~60% done (don’t ship it)

Slide 37

Slide 37 text

Take it to the finish line

Slide 38

Slide 38 text

❄ Use cool downs for Kotlin

Slide 39

Slide 39 text

Leave the campsite cleaner than you found it

Slide 40

Slide 40 text

Things might get ugly

Slide 41

Slide 41 text

Curb your enthusiasm

Slide 42

Slide 42 text

No content

Slide 43

Slide 43 text

fun success(inboxItems: InboxItems) = with(inboxItems.withoutPings()) { doAsync { CachePrefs.setInboxCache(context, this@with) } }

Slide 44

Slide 44 text

fun success(inboxItems: InboxItems) = with(inboxItems.withoutPings()) { doAsync { CachePrefs.setInboxCache(context, this@with) } }

Slide 45

Slide 45 text

fun success(inboxItems: InboxItems) = with(inboxItems.withoutPings()) { doAsync { CachePrefs.setInboxCache(context, this@with) } }

Slide 46

Slide 46 text

fun success(inboxItems: InboxItems) = with(inboxItems.withoutPings()) { doAsync { CachePrefs.setInboxCache(context, this@with) } }

Slide 47

Slide 47 text

fun success(inboxItems: InboxItems) = with(inboxItems.withoutPings()) { doAsync { CachePrefs.setInboxCache(context, this@with) } }

Slide 48

Slide 48 text

fun success(inboxItems: InboxItems) {
 val items = inboxItems.filterNot { ... } 
 doAsync { CachePrefs.setInboxCache(context, items) }
 }

Slide 49

Slide 49 text

fun success(inboxItems: InboxItems) {
 val items = inboxItems.filterNot { ... } 
 doAsync { CachePrefs.setInboxCache(context, items) }
 }

Slide 50

Slide 50 text

fun success(inboxItems: InboxItems) {
 val items = inboxItems.filterNot { ... } 
 doAsync { CachePrefs.setInboxCache(context, items) }
 }

Slide 51

Slide 51 text

fun success(inboxItems: InboxItems) {
 val items = inboxItems.filterNot { ... } 
 doAsync { CachePrefs.setInboxCache(context, items) }
 }

Slide 52

Slide 52 text

fun success(inboxItems: InboxItems) {
 val items = inboxItems.filterNot { ... } 
 doAsync { CachePrefs.setInboxCache(context, items) }
 }

Slide 53

Slide 53 text

Keep an eye on your code organization

Slide 54

Slide 54 text

Don’t forget about your customers

Slide 55

Slide 55 text

Programmer happiness is crucial!

Slide 56

Slide 56 text

Your customers don’t care

Slide 57

Slide 57 text

Take your time

Slide 58

Slide 58 text

430 days!

Slide 59

Slide 59 text

It’s just a number

Slide 60

Slide 60 text

Thank you! [email protected] @dankim