Slide 1

Slide 1 text

Inheritance ,
 Interfaces and Composition Hector Zarate (@iOSCowboy)

Slide 2

Slide 2 text

Inheritance ,
 Interfaces and Composition Hector Zarate (@iOSCowboy)

Slide 3

Slide 3 text

Agenda 1. Inheritance 2. Protocols (Interfaces) 3.Composition

Slide 4

Slide 4 text

1. Inheritance

Slide 5

Slide 5 text

> The big dinosaur from the Jurassic World movie, That one that chases the girl in high heels. Not the bad one. The one that is chill. , but pink!

Slide 6

Slide 6 text

Tyrannosaurus Rex

Slide 7

Slide 7 text

1.Kingdom 2.Class 3.Order 4.Genera 5.Species Less specific

Slide 8

Slide 8 text

More specific 1.Kingdom 2.Class 3.Order 4.Genera 5.Species

Slide 9

Slide 9 text

Animal, Plants, Stuff 1.Kingdom 2.Class 3.Order 4.Genera 5.Species

Slide 10

Slide 10 text

Animal, Plants, Stuff Mammals, Birds, Amphibia, Fish, Insects… 1.Kingdom 2.Class 3.Order 4.Genera 5.Species

Slide 11

Slide 11 text

Animal, Plants, Stuff Mammals, Birds, Amphibia, Fish, Insects… Anthropomorphic, Fera, Jumenta… 1.Kingdom 2.Class 3.Order 4.Genera 5.Species

Slide 12

Slide 12 text

Animal, Plants, Stuff Mammals, Birds, Amphibia, Fish, Insects… Anthropomorphic, Fera, Jumenta… Felis 1.Kingdom 2.Class 3.Order 4.Genera 5.Species

Slide 13

Slide 13 text

Animal, Plants, Stuff Mammals, Birds, Amphibia, Fish, Insects… Anthropomorphic, Fera, Jumenta… Felis Tigris, Panther 1.Kingdom 2.Class 3.Order 4.Genera 5.Species

Slide 14

Slide 14 text

@interface AnimalKingdom - (void)move; - (void)ingest:(id)animalOrProduct; @end @interface MammalClass : AnimalKingdom @property (nonatomic) Organ *heart; @property (nonatomic) Organ *lung; -(void)drinkMilk; @end @interface FeraOrder : MammalClass @property (nonatomic) Organ *teeth; @end @interface FelisGenra : FeraOrder @property (nonatomic) Organ *tail; @end @interface TigrisSpecie : FelisGenra @end

Slide 15

Slide 15 text

Animal Quadruped Fera Tigris Tigris Inheritance is indicated by a solid line with an arrowhead pointing at the super class

Slide 16

Slide 16 text

NSObject UIResponder UIView UIControl UIButton

Slide 17

Slide 17 text

Animal, Plants, Stuff Mammal, Birds, Amphibia, Fish, Insects… Anthropomorphic, Fera, Jumenta… Felis Tigris, Panther 1.Kingdom 2.Class 3.Order 4.Genera 5.Species

Slide 18

Slide 18 text

Organization by Commonalties

Slide 19

Slide 19 text

Exercise 1: Inheritance 0 25 50 75 100 April May June July 0 25 50 75 100 April May June July 0 25 50 75 100 April May June July

Slide 20

Slide 20 text

1. Spoti-Case Study:
 UI

Slide 21

Slide 21 text

No content

Slide 22

Slide 22 text

GLUE (Global Language, Unified Experience)

Slide 23

Slide 23 text

Fonts Colors Metrics

Slide 24

Slide 24 text

No content

Slide 25

Slide 25 text

No content

Slide 26

Slide 26 text

No content

Slide 27

Slide 27 text

No content

Slide 28

Slide 28 text

No content

Slide 29

Slide 29 text

No content

Slide 30

Slide 30 text

No content

Slide 31

Slide 31 text

No content

Slide 32

Slide 32 text

No content

Slide 33

Slide 33 text

UIKit GLUE.framework Radio Running Albums Shows

Slide 34

Slide 34 text

GLUE.framework

Slide 35

Slide 35 text

GLUE.framework / 1. Subclassing UIButton SPTActionButton UICollectionViewCell SPTTableBasedCollectionViewCell SPTCollectionViewCell

Slide 36

Slide 36 text

GLUE.framework / 2. Factories UIImage+SPTIcon.h UIImageView+SPTImageStyleMasking.h UILabel+SPTDefaultApperance.h

Slide 37

Slide 37 text

GLUE.framework / 3. Configuration Colors.json Metrics.json Fonts.json

Slide 38

Slide 38 text

GLUE.framework Colors.json SPTTheme.h

Slide 39

Slide 39 text

GLUE.framework

Slide 40

Slide 40 text

UIKit GLUE.framework Radio Running Albums Shows

Slide 41

Slide 41 text

Colors.json { "glueBlackColor": "000000", "glueGray25Color": "3E3E40", "glueGray55Color": "88898C", "glueGray80Color": "c6c7cc", "glueGray90Color": "DFE0E6", "glueWhiteColor": "ffffff", "glueGreenLightColor": "1ed760", "glueGreenColor": "1db954", "glueGreenDarkColor": "1da74d", }

Slide 42

Slide 42 text

Colors.json { "glueBlackColor": "000000", "glueGray25Color": "3E3E40", "glueGray55Color": "88898C", "glueGray80Color": "c6c7cc", "glueGray90Color": "DFE0E6", "glueWhiteColor": "ffffff", "glueGreenLightColor": "1ed760", "glueGreenColor": "c53770", "glueGreenDarkColor": "1da74d", }

Slide 43

Slide 43 text

No content

Slide 44

Slide 44 text

2. Interfaces

Slide 45

Slide 45 text

1. A scientist or business person 2.good sense of humor 3.smart 4.very successful 5.good looking

Slide 46

Slide 46 text

No content

Slide 47

Slide 47 text

1. A scientist or business person 2.good sense of humor 3.smart 4.very successful 5.good looking

Slide 48

Slide 48 text

@protocol PerfectMan - (void)researchScience; - (void)doBusiness; - (void)crackJokes; - (void)beSmart; - (void)succeedInLife; - (void)lookAwesome; @end

Slide 49

Slide 49 text

Iron Man PerfectMan Batman Ellon Musk Realizing an interface is indicated by a dashed line with an arrowhead pointing at the interface

Slide 50

Slide 50 text

Iron Man PerfectMan Batman Ellon Musk CEO

Slide 51

Slide 51 text

Compliance with Specifications

Slide 52

Slide 52 text

APIs

Slide 53

Slide 53 text

Exercise 2: Protocols 0 25 50 75 100 April May June July 0 25 50 75 100 April May June July 0 25 50 75 100 April May June July

Slide 54

Slide 54 text

2. Spoti-Case Study:
 Feature System

Slide 55

Slide 55 text

Radio Running Album Show Player Browse Artist Playlist Social Conce Car Chart scover Genre Ads Equalizer Inbox Podcast

Slide 56

Slide 56 text

Radio Running Album Show Player Browse Artist Playlist Social Conce Car Chart scover Genre Ads Equalizer Inbox Podcast

Slide 57

Slide 57 text

Radio Running Album Show Player Browse Artist Playlist Social Conce Car Chart scover Genre Ads Equalizer Inbox Podcast

Slide 58

Slide 58 text

Radio Running Album Show Player Browse Artist Playlist Social Conce Car Chart scover Genre Ads Equalizer Inbox Podcast

Slide 59

Slide 59 text

Radio Running Album Show Player Browse Artist Playlist Social Conce Car Chart scover Genre Ads Equalizer Inbox Podcast

Slide 60

Slide 60 text

Radio Running Album Show Player Browse Artist Playlist Social Conce Car Chart scover Genre Ads Equalizer Inbox Podcast

Slide 61

Slide 61 text

Radio Running Album Show Player Browse Artist Playlist Social Conce Car Chart scover Genre Ads Equalizer Inbox Podcast

Slide 62

Slide 62 text

3. Composition

Slide 63

Slide 63 text

Engine Car >> Stereo

Slide 64

Slide 64 text

Engine Car >> Stereo Satellite Radio FM Radio

Slide 65

Slide 65 text

Hierarchy of Simpler Subsystems

Slide 66

Slide 66 text

Exercise 3: Composition 0 25 50 75 100 April May June July 0 25 50 75 100 April May June July 0 25 50 75 100 April May June July

Slide 67

Slide 67 text

2. Spoti-Case Study:
 User Session

Slide 68

Slide 68 text

@interface SPTSession : NSObject @property (nonatomic, readonly) SPTProductState *productState; @property (nonatomic, readonly) SPTSocialManager *socialManager; @property (nonatomic, readonly) AdController *adController; @property (nonatomic, readonly) SPUser *currentUser; @property (nonatomic, readonly) SPPlaylist *inbox; @end

Slide 69

Slide 69 text

AdController SocialManager SPSession ProductState SPUser SPPlaylist

Slide 70

Slide 70 text

Dzjienki!

Slide 71

Slide 71 text

Questions? Hector Zarate @iOSCowboy spotify.com/jobs