Павел Тайкало: "Optimistic Approach : How to show results instead spinners without...
Transcript of Павел Тайкало: "Optimistic Approach : How to show results instead spinners without...
![Page 1: Павел Тайкало: "Optimistic Approach : How to show results instead spinners without breaking your Application"](https://reader031.fdocuments.us/reader031/viewer/2022030311/58ef21361a28abd2688b456b/html5/thumbnails/1.jpg)
Optimistic ApproachHow to show results instead spinnerswithout breaking your Application
by Paul Taykalo, StanfyPaul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 1
![Page 2: Павел Тайкало: "Optimistic Approach : How to show results instead spinners without breaking your Application"](https://reader031.fdocuments.us/reader031/viewer/2022030311/58ef21361a28abd2688b456b/html5/thumbnails/2.jpg)
Optimistic ApproachWhat is it about?
Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 2
![Page 3: Павел Тайкало: "Optimistic Approach : How to show results instead spinners without breaking your Application"](https://reader031.fdocuments.us/reader031/viewer/2022030311/58ef21361a28abd2688b456b/html5/thumbnails/3.jpg)
Optimistic Approach4 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
![Page 4: Павел Тайкало: "Optimistic Approach : How to show results instead spinners without breaking your Application"](https://reader031.fdocuments.us/reader031/viewer/2022030311/58ef21361a28abd2688b456b/html5/thumbnails/4.jpg)
How mobile application works
Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 4
![Page 5: Павел Тайкало: "Optimistic Approach : How to show results instead spinners without breaking your Application"](https://reader031.fdocuments.us/reader031/viewer/2022030311/58ef21361a28abd2688b456b/html5/thumbnails/5.jpg)
How mobile application works4 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
![Page 6: Павел Тайкало: "Optimistic Approach : How to show results instead spinners without breaking your Application"](https://reader031.fdocuments.us/reader031/viewer/2022030311/58ef21361a28abd2688b456b/html5/thumbnails/6.jpg)
Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 6
![Page 7: Павел Тайкало: "Optimistic Approach : How to show results instead spinners without breaking your Application"](https://reader031.fdocuments.us/reader031/viewer/2022030311/58ef21361a28abd2688b456b/html5/thumbnails/7.jpg)
User need to wait
Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 7
![Page 8: Павел Тайкало: "Optimistic Approach : How to show results instead spinners without breaking your Application"](https://reader031.fdocuments.us/reader031/viewer/2022030311/58ef21361a28abd2688b456b/html5/thumbnails/8.jpg)
User need to waitBut user don't like to wait
Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 8
![Page 9: Павел Тайкало: "Optimistic Approach : How to show results instead spinners without breaking your Application"](https://reader031.fdocuments.us/reader031/viewer/2022030311/58ef21361a28abd2688b456b/html5/thumbnails/9.jpg)
User need to waitBut user don't like to waitUser don't have time to wait
Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 9
![Page 10: Павел Тайкало: "Optimistic Approach : How to show results instead spinners without breaking your Application"](https://reader031.fdocuments.us/reader031/viewer/2022030311/58ef21361a28abd2688b456b/html5/thumbnails/10.jpg)
Loading next slide
Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 10
![Page 11: Павел Тайкало: "Optimistic Approach : How to show results instead spinners without breaking your Application"](https://reader031.fdocuments.us/reader031/viewer/2022030311/58ef21361a28abd2688b456b/html5/thumbnails/11.jpg)
Solutions?Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 11
![Page 12: Павел Тайкало: "Optimistic Approach : How to show results instead spinners without breaking your Application"](https://reader031.fdocuments.us/reader031/viewer/2022030311/58ef21361a28abd2688b456b/html5/thumbnails/12.jpg)
Solutions - Making app faster4 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
![Page 13: Павел Тайкало: "Optimistic Approach : How to show results instead spinners without breaking your Application"](https://reader031.fdocuments.us/reader031/viewer/2022030311/58ef21361a28abd2688b456b/html5/thumbnails/13.jpg)
Solutions - One step ahead4 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
![Page 14: Павел Тайкало: "Optimistic Approach : How to show results instead spinners without breaking your Application"](https://reader031.fdocuments.us/reader031/viewer/2022030311/58ef21361a28abd2688b456b/html5/thumbnails/14.jpg)
Solutions - Entertain user
Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 14
![Page 15: Павел Тайкало: "Optimistic Approach : How to show results instead spinners without breaking your Application"](https://reader031.fdocuments.us/reader031/viewer/2022030311/58ef21361a28abd2688b456b/html5/thumbnails/15.jpg)
Solutions - Entertain the user4 Animations
4 Push/Pop
4 Spinner
4 Progress
4 Skeleton
4 Partial infoPaul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 15
![Page 16: Павел Тайкало: "Optimistic Approach : How to show results instead spinners without breaking your Application"](https://reader031.fdocuments.us/reader031/viewer/2022030311/58ef21361a28abd2688b456b/html5/thumbnails/16.jpg)
Solutions - Predict the result4 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
![Page 17: Павел Тайкало: "Optimistic Approach : How to show results instead spinners without breaking your Application"](https://reader031.fdocuments.us/reader031/viewer/2022030311/58ef21361a28abd2688b456b/html5/thumbnails/17.jpg)
Solutions - Predict the result4 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
![Page 18: Павел Тайкало: "Optimistic Approach : How to show results instead spinners without breaking your Application"](https://reader031.fdocuments.us/reader031/viewer/2022030311/58ef21361a28abd2688b456b/html5/thumbnails/18.jpg)
Types of userinteractions
Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 18
![Page 19: Павел Тайкало: "Optimistic Approach : How to show results instead spinners without breaking your Application"](https://reader031.fdocuments.us/reader031/viewer/2022030311/58ef21361a28abd2688b456b/html5/thumbnails/19.jpg)
Actionsand
ExpectationsPaul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 19
![Page 20: Павел Тайкало: "Optimistic Approach : How to show results instead spinners without breaking your Application"](https://reader031.fdocuments.us/reader031/viewer/2022030311/58ef21361a28abd2688b456b/html5/thumbnails/20.jpg)
Actions and Expectations4 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
![Page 21: Павел Тайкало: "Optimistic Approach : How to show results instead spinners without breaking your Application"](https://reader031.fdocuments.us/reader031/viewer/2022030311/58ef21361a28abd2688b456b/html5/thumbnails/21.jpg)
Predictabevs
*elbatciderpnU_Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 21
![Page 22: Павел Тайкало: "Optimistic Approach : How to show results instead spinners without breaking your Application"](https://reader031.fdocuments.us/reader031/viewer/2022030311/58ef21361a28abd2688b456b/html5/thumbnails/22.jpg)
PredictablePaul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 22
![Page 23: Павел Тайкало: "Optimistic Approach : How to show results instead spinners without breaking your Application"](https://reader031.fdocuments.us/reader031/viewer/2022030311/58ef21361a28abd2688b456b/html5/thumbnails/23.jpg)
PredictableIf 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
![Page 24: Павел Тайкало: "Optimistic Approach : How to show results instead spinners without breaking your Application"](https://reader031.fdocuments.us/reader031/viewer/2022030311/58ef21361a28abd2688b456b/html5/thumbnails/24.jpg)
Optimistic models
Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 24
![Page 25: Павел Тайкало: "Optimistic Approach : How to show results instead spinners without breaking your Application"](https://reader031.fdocuments.us/reader031/viewer/2022030311/58ef21361a28abd2688b456b/html5/thumbnails/25.jpg)
Non optimistic model
Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 25
![Page 26: Павел Тайкало: "Optimistic Approach : How to show results instead spinners without breaking your Application"](https://reader031.fdocuments.us/reader031/viewer/2022030311/58ef21361a28abd2688b456b/html5/thumbnails/26.jpg)
Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 26
![Page 27: Павел Тайкало: "Optimistic Approach : How to show results instead spinners without breaking your Application"](https://reader031.fdocuments.us/reader031/viewer/2022030311/58ef21361a28abd2688b456b/html5/thumbnails/27.jpg)
Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 27
![Page 28: Павел Тайкало: "Optimistic Approach : How to show results instead spinners without breaking your Application"](https://reader031.fdocuments.us/reader031/viewer/2022030311/58ef21361a28abd2688b456b/html5/thumbnails/28.jpg)
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
![Page 29: Павел Тайкало: "Optimistic Approach : How to show results instead spinners without breaking your Application"](https://reader031.fdocuments.us/reader031/viewer/2022030311/58ef21361a28abd2688b456b/html5/thumbnails/29.jpg)
Following a person// Saving original for later usagePerson *original = self.person;
// Create fake resultPerson *fake = [self.person copy];fake.followingStatus = @"Following";
// Updating current objectself.person = fake;resultBlock(fake, nil);
Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 29
![Page 30: Павел Тайкало: "Optimistic Approach : How to show results instead spinners without breaking your Application"](https://reader031.fdocuments.us/reader031/viewer/2022030311/58ef21361a28abd2688b456b/html5/thumbnails/30.jpg)
Following a personif (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
![Page 31: Павел Тайкало: "Optimistic Approach : How to show results instead spinners without breaking your Application"](https://reader031.fdocuments.us/reader031/viewer/2022030311/58ef21361a28abd2688b456b/html5/thumbnails/31.jpg)
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
![Page 32: Павел Тайкало: "Optimistic Approach : How to show results instead spinners without breaking your Application"](https://reader031.fdocuments.us/reader031/viewer/2022030311/58ef21361a28abd2688b456b/html5/thumbnails/32.jpg)
What about non-breaking?
Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 32
![Page 33: Павел Тайкало: "Optimistic Approach : How to show results instead spinners without breaking your Application"](https://reader031.fdocuments.us/reader031/viewer/2022030311/58ef21361a28abd2688b456b/html5/thumbnails/33.jpg)
Correct View Layer
MVVM*Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 33
![Page 34: Павел Тайкало: "Optimistic Approach : How to show results instead spinners without breaking your Application"](https://reader031.fdocuments.us/reader031/viewer/2022030311/58ef21361a28abd2688b456b/html5/thumbnails/34.jpg)
Correct View Layer
Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 34
![Page 35: Павел Тайкало: "Optimistic Approach : How to show results instead spinners without breaking your Application"](https://reader031.fdocuments.us/reader031/viewer/2022030311/58ef21361a28abd2688b456b/html5/thumbnails/35.jpg)
Correct View Layer
Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 35
![Page 36: Павел Тайкало: "Optimistic Approach : How to show results instead spinners without breaking your Application"](https://reader031.fdocuments.us/reader031/viewer/2022030311/58ef21361a28abd2688b456b/html5/thumbnails/36.jpg)
Hiperactive User?
Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 36
![Page 37: Павел Тайкало: "Optimistic Approach : How to show results instead spinners without breaking your Application"](https://reader031.fdocuments.us/reader031/viewer/2022030311/58ef21361a28abd2688b456b/html5/thumbnails/37.jpg)
Hiperactive User?like unlike like unlike like unlike like unlikelike unlike like unlike like unlike like unlikelike unlike like unlike like unlike like unlikelike unlike like unlike like unlike like unlikePaul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 37
![Page 38: Павел Тайкало: "Optimistic Approach : How to show results instead spinners without breaking your Application"](https://reader031.fdocuments.us/reader031/viewer/2022030311/58ef21361a28abd2688b456b/html5/thumbnails/38.jpg)
State based on multiple updates
Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 38
![Page 39: Павел Тайкало: "Optimistic Approach : How to show results instead spinners without breaking your Application"](https://reader031.fdocuments.us/reader031/viewer/2022030311/58ef21361a28abd2688b456b/html5/thumbnails/39.jpg)
State based on multiple updatesTake a look at Parse SDKPFObjectEstimatedData.h
Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 39
![Page 40: Павел Тайкало: "Optimistic Approach : How to show results instead spinners without breaking your Application"](https://reader031.fdocuments.us/reader031/viewer/2022030311/58ef21361a28abd2688b456b/html5/thumbnails/40.jpg)
Demo?Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 40
![Page 41: Павел Тайкало: "Optimistic Approach : How to show results instead spinners without breaking your Application"](https://reader031.fdocuments.us/reader031/viewer/2022030311/58ef21361a28abd2688b456b/html5/thumbnails/41.jpg)
Recap
Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 41
![Page 42: Павел Тайкало: "Optimistic Approach : How to show results instead spinners without breaking your Application"](https://reader031.fdocuments.us/reader031/viewer/2022030311/58ef21361a28abd2688b456b/html5/thumbnails/42.jpg)
Recap4 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
![Page 43: Павел Тайкало: "Optimistic Approach : How to show results instead spinners without breaking your Application"](https://reader031.fdocuments.us/reader031/viewer/2022030311/58ef21361a28abd2688b456b/html5/thumbnails/43.jpg)
Last slide :)
Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 43
![Page 44: Павел Тайкало: "Optimistic Approach : How to show results instead spinners without breaking your Application"](https://reader031.fdocuments.us/reader031/viewer/2022030311/58ef21361a28abd2688b456b/html5/thumbnails/44.jpg)
Optimistic ApproachHow to show results instead spinnerswithout breaking your Application
by Paul Taykalo, StanfyPaul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 44
![Page 45: Павел Тайкало: "Optimistic Approach : How to show results instead spinners without breaking your Application"](https://reader031.fdocuments.us/reader031/viewer/2022030311/58ef21361a28abd2688b456b/html5/thumbnails/45.jpg)
Links4 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
![Page 46: Павел Тайкало: "Optimistic Approach : How to show results instead spinners without breaking your Application"](https://reader031.fdocuments.us/reader031/viewer/2022030311/58ef21361a28abd2688b456b/html5/thumbnails/46.jpg)
Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 46