Slide 1

Slide 1 text

Writing future proof Swift Erwin Zwart iOS Developer @ The Capitals

Slide 2

Slide 2 text

No content

Slide 3

Slide 3 text

Code lives in an ever changing environment How can you plan for the future if you don’t know what’s ahead?

Slide 4

Slide 4 text

If time allows it • Write automated tests • Do code review

Slide 5

Slide 5 text

On a code level • Avoid assumptions, restrict your intentions • Write code that models what it represent • Write shy code

Slide 6

Slide 6 text

Avoid assumptions, restrict your intentions

Slide 7

Slide 7 text

–A lot of people in 2012 “The iPhone screen is always 320 x 460px”

Slide 8

Slide 8 text

–A lot of people in 2012 “The iPhone screen is always 320 x 460px”

Slide 9

Slide 9 text

–A lot of people in 2014 “The navigation bar is always has a height of 64px”

Slide 10

Slide 10 text

–A lot of people in 2014 “The navigation bar is always has a height of 64px”

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

All of these assumptions are wrong • There are always 24 hours in a day. • Months have either 30 or 31 days. • Years have 365 days. • Any 24-hour period will always begin and end in the same day (or week, or month). • A week always begins and ends in the same month. • A week (or a month) always begins and ends in the same year. Source: FalsehoodsAboutTime.com

Slide 13

Slide 13 text

Write code that models what it represent

Slide 14

Slide 14 text

Write shy code • Each unit should have only limited knowledge about other units: only units “closely” related to the current unit. • Each unit should only talk to its friends; don’t talk to strangers. • Only talk to your immediate friends. Source: Umer Mansoor, codeahoy.com

Slide 15

Slide 15 text

Examples

Slide 16

Slide 16 text

Questions? [email protected] @e_zwart