Slide 1

Slide 1 text

Optimistic Approach How to show results instead spinners without breaking your Application by Paul Taykalo, Stanfy Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 1

Slide 2

Slide 2 text

Optimistic Approach What is it about? Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 2

Slide 3

Slide 3 text

Optimistic Approach 4 Speeding up application 4 "Speeding" up application 4 Making user happier 4 It's all about user-friendliness Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 3

Slide 4

Slide 4 text

How mobile application works Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 4

Slide 5

Slide 5 text

How mobile application works 4 Handle user action 4 Send request to the server 4 Get response from the server 4 Update UI Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 5

Slide 6

Slide 6 text

Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 6

Slide 7

Slide 7 text

User need to wait Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 7

Slide 8

Slide 8 text

User need to wait But user don't like to wait Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 8

Slide 9

Slide 9 text

User need to wait But user don't like to wait User don't have time to wait Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 9

Slide 10

Slide 10 text

Loading next slide Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 10

Slide 11

Slide 11 text

Solutions? Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 11

Slide 12

Slide 12 text

Solutions - Making app faster 4 Decrease sizes 4 Compression 4 Opened connection to the server Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 12

Slide 13

Slide 13 text

Solutions - One step ahead 4 Caching 4 Preload pages 4 Load content in the backround 4 Be prepared Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 13

Slide 14

Slide 14 text

Solutions - Entertain user Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 14

Slide 15

Slide 15 text

Solutions - Entertain the user 4 Animations 4 Push/Pop 4 Spinner 4 Progress 4 Skeleton 4 Partial info Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 15

Slide 16

Slide 16 text

Solutions - Predict the result 4 Precalculate result 4 Show it to user 4 ???? Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 16

Slide 17

Slide 17 text

Solutions - Predict the result 4 Precalculate result 4 Show it to user 4 Pray :) Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 17

Slide 18

Slide 18 text

Types of user interactions Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 18

Slide 19

Slide 19 text

Actions and Expectations Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 19

Slide 20

Slide 20 text

Actions and Expectations 4 If I press like I expect that 4 If I edit post I expect that 4 If I follow this guy I expect that 4 If I open a post I expect that 4 If I ask for a radom number I expect that Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 20

Slide 21

Slide 21 text

Predictabe vs *elbatciderpnU_ Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 21

Slide 22

Slide 22 text

Predictable Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 22

Slide 23

Slide 23 text

Predictable If I can predict the result, why should I wait for confirmation? Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 23

Slide 24

Slide 24 text

Optimistic models Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 24

Slide 25

Slide 25 text

Non optimistic model Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 25

Slide 26

Slide 26 text

Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 26

Slide 27

Slide 27 text

Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 27

Slide 28

Slide 28 text

Following a person [self.requestManager follow:original result:^(Person *res, NSError *err) { if (err) { // Handling error resultBlock(nik, err); } else { // Updating to the new value resultBlock(res, nil); } }]; Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 28

Slide 29

Slide 29 text

Following a person // Saving original for later usage Person *original = self.person; // Create fake result Person *fake = [self.person copy]; fake.followingStatus = @"Following"; // Updating current object self.person = fake; resultBlock(fake, nil); Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 29

Slide 30

Slide 30 text

Following a person if (error) { // rollback weakSelf.person = original; resultBlock(original, error); } else { // Updating to the new value weakSelf.person = updatedPerson; resultBlock(updatedPerson, nil); } Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 30

Slide 31

Slide 31 text

Following a person // Following a person - (void)follow:(void (^)(Person *person, NSError *error))resultBlock { __weak __typeof(self) weakSelf = self; // Saving original for later usage Person *original = self.person; // Create fake result Person *fake = [self.person copy]; fake.followingStatus = @"Following"; // Updating current object self.person = fake; resultBlock(fake, nil); // Calling request manager [self.requestManager followPerson:original result:^(Person *updatedPerson, NSError *error) { if (error) { // rollback weakSelf.person = original; resultBlock(original, error); } else { // Updating to the new value weakSelf.person = updatedPerson; resultBlock(updatedPerson, nil); } }]; } Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 31

Slide 32

Slide 32 text

What about non-breaking? Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 32

Slide 33

Slide 33 text

Correct View Layer MVVM* Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 33

Slide 34

Slide 34 text

Correct View Layer Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 34

Slide 35

Slide 35 text

Correct View Layer Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 35

Slide 36

Slide 36 text

Hiperactive User? Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 36

Slide 37

Slide 37 text

Hiperactive User? like unlike like unlike like unlike like unlike like unlike like unlike like unlike like unlike like unlike like unlike like unlike like unlike like unlike like unlike like unlike like unlike Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 37

Slide 38

Slide 38 text

State based on multiple updates Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 38

Slide 39

Slide 39 text

State based on multiple updates Take a look at Parse SDK PFObjectEstimatedData.h Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 39

Slide 40

Slide 40 text

Demo? Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 40

Slide 41

Slide 41 text

Recap Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 41

Slide 42

Slide 42 text

Recap 4 It's pretty easy to trick user 4 Show user what he expect 4 Fight for your users, they deserve it 4 Now you can write even cooler apps :) Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 42

Slide 43

Slide 43 text

Last slide :) Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 43

Slide 44

Slide 44 text

Optimistic Approach How to show results instead spinners without breaking your Application by Paul Taykalo, Stanfy Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 44

Slide 45

Slide 45 text

Links 4 http://www.reactnative.com/ 4 https://speakerdeck.com/frantic/react-native- under-the-hood 4 https://medium.com/stanfy-engineering-practices/ do-not-let-your-user-see-spinners-35b824c3ce2f 4 ComponentKit Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 45

Slide 46

Slide 46 text

Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 46