Slide 1

Slide 1 text

i4☕

Slide 2

Slide 2 text

Code that smells aka ‘bydlo-code’

Slide 3

Slide 3 text

kill me, please

Slide 4

Slide 4 text

don’t write code that smells

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

there was a dev team…

Slide 7

Slide 7 text

there was a dev team… …writing on ObjC

Slide 8

Slide 8 text

and they decided to switch to Swift!

Slide 9

Slide 9 text

and they decided to switch to Swift! in production!

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

it was nice morning and PM decided to install app

Slide 12

Slide 12 text

it was nice morning and PM decided to install app on device!

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

it’s not us! it’s new 7.3 Xcode!

Slide 15

Slide 15 text

oh no, it’s us :(

Slide 16

Slide 16 text

"loadData has not been implemented" found in logs

Slide 17

Slide 17 text

No content

Slide 18

Slide 18 text

– loadData(…) -> … – loadData(…) -> … ChildTableViewController BaseTableViewController

Slide 19

Slide 19 text

BaseTableViewController – loadData(…) -> … ChildTableViewController – loadData(…) -> … generics stub overriden

Slide 20

Slide 20 text

BaseTableViewController – loadData(…) -> … ChildTableViewController – loadData(…) -> … generics stub overriden not called at all

Slide 21

Slide 21 text

A – architecture

Slide 22

Slide 22 text

Problem solving

Slide 23

Slide 23 text

What if we disable optimization?

Slide 24

Slide 24 text

let’s disable optimization..

Slide 25

Slide 25 text

too many optimizations! swift compiler optimization!

Slide 26

Slide 26 text

Why debug is ok?

Slide 27

Slide 27 text

…Testability

Slide 28

Slide 28 text

Debug Release Optimization Testability WMO yes WMO no

Slide 29

Slide 29 text

WMO https://developer.apple.com/swift/blog/?id=27 if method has no ‘internal’ access, compiler may mark it as ‘final’

Slide 30

Slide 30 text

Testability allows you to use all ‘internal’ methods in tests like ‘public’

Slide 31

Slide 31 text

everything is ok overriden methods may be lost Debug Release Optimization Testability WMO yes WMO no

Slide 32

Slide 32 text

tweet all the things!

Slide 33

Slide 33 text

tweet all the things!

Slide 34

Slide 34 text

sudden help!

Slide 35

Slide 35 text

sudden help! swift contributor

Slide 36

Slide 36 text

https://gist.github.com/PaulTaykalo/5c97010874a93626ca3c Minimal crashable code

Slide 37

Slide 37 text

http://openradar.appspot.com/radar?id=4971716266688512 Filed Radar

Slide 38

Slide 38 text

SIL devirtualization: Conservatively avoid filtering devirt candidates on generic base classes Fix by @jckarter https://github.com/apple/swift/pull/1954

Slide 39

Slide 39 text

SIL devirtualization: Conservatively avoid filtering devirt candidates on generic base classes Fix by @jckarter https://github.com/apple/swift/pull/1954

Slide 40

Slide 40 text

Fix by @jckarter fix! https://github.com/apple/swift/pull/1954

Slide 41

Slide 41 text

Tests https://github.com/apple/swift/pull/1954

Slide 42

Slide 42 text

Swift 2.2 Patch https://github.com/apple/swift/pull/1954

Slide 43

Slide 43 text

Lessons learnt

Slide 44

Slide 44 text

Lesson #1 every decision has consequences

Slide 45

Slide 45 text

sooner or later they’ll appear Lesson #1 every decision has consequences

Slide 46

Slide 46 text

Lesson #2 always try build in release on device

Slide 47

Slide 47 text

at least once a day Lesson #2 always try build in release on device

Slide 48

Slide 48 text

and community Lesson #3 twitter rulez

Slide 49

Slide 49 text

Lesson #4 PMs are useful

Slide 50

Slide 50 text

sometimes Lesson #4 PMs are useful

Slide 51

Slide 51 text

team: Vitaliy, Igor, Paul Thanks community: @akosma, @jckarter PM: Anna

Slide 52

Slide 52 text

No content