SlideShare a Scribd company logo
1 of 46
Download to read offline
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
Optimistic Approach
What is it about?
Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 2
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
How mobile application works
Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 4
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
Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 6
User need to wait
Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 7
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
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
Loading next slide
Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 10
Solutions?
Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 11
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
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
Solutions - Entertain user
Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 14
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
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
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
Types of user
interactions
Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 18
Actions
and
Expectations
Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 19
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
Predictabevs
*elbatciderpnU_
Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 21
Predictable
Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 22
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
Optimistic models
Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 24
Non optimistic model
Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 25
Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 26
Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 27
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
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
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
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
What about non-breaking?
Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 32
Correct View Layer
MVVM*
Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 33
Correct View Layer
Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 34
Correct View Layer
Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 35
Hiperactive User?
Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 36
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
State based on multiple updates
Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 38
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
Demo?Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 40
Recap
Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 41
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
Last slide :)
Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 43
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
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
Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 46

More Related Content

Viewers also liked (8)

Love
LoveLove
Love
 
How To Be Optimistic
How To Be OptimisticHow To Be Optimistic
How To Be Optimistic
 
Think Happy, Talk Happy, Feel Happy, Be Happy
Think Happy, Talk Happy, Feel Happy, Be HappyThink Happy, Talk Happy, Feel Happy, Be Happy
Think Happy, Talk Happy, Feel Happy, Be Happy
 
Happiness presentation ppt
Happiness presentation pptHappiness presentation ppt
Happiness presentation ppt
 
What do we know about happiness
What do we know about happinessWhat do we know about happiness
What do we know about happiness
 
Happiness Presentation
Happiness PresentationHappiness Presentation
Happiness Presentation
 
Love Presentation
Love PresentationLove Presentation
Love Presentation
 
How I got 2.5 Million views on Slideshare (by @nickdemey - Board of Innovation)
How I got 2.5 Million views on Slideshare (by @nickdemey - Board of Innovation)How I got 2.5 Million views on Slideshare (by @nickdemey - Board of Innovation)
How I got 2.5 Million views on Slideshare (by @nickdemey - Board of Innovation)
 

Similar to Optimistic Approach. How to show results instead spinners without breaking your application.

Cro day: converting trial users to paid customers
Cro day: converting trial users to paid customersCro day: converting trial users to paid customers
Cro day: converting trial users to paid customers
Kyle Racki
 

Similar to Optimistic Approach. How to show results instead spinners without breaking your application. (20)

Growth Hacking Conference '17 - Antwerp
Growth Hacking Conference '17 - AntwerpGrowth Hacking Conference '17 - Antwerp
Growth Hacking Conference '17 - Antwerp
 
Lean startup toolkit 2019
Lean startup toolkit 2019Lean startup toolkit 2019
Lean startup toolkit 2019
 
Lean startup and beyond nicolas sassoli
Lean startup and beyond nicolas sassoliLean startup and beyond nicolas sassoli
Lean startup and beyond nicolas sassoli
 
7 Test Ideas to Improve User Onboarding
7 Test Ideas to Improve User Onboarding7 Test Ideas to Improve User Onboarding
7 Test Ideas to Improve User Onboarding
 
Pretotyping: Crash Test Your Idea - ITESCIA 2015-2016 (English Version)
Pretotyping: Crash Test Your Idea - ITESCIA 2015-2016 (English Version)Pretotyping: Crash Test Your Idea - ITESCIA 2015-2016 (English Version)
Pretotyping: Crash Test Your Idea - ITESCIA 2015-2016 (English Version)
 
How and why you should do UX Testing, Tech Meeting
How and why you should do UX Testing, Tech MeetingHow and why you should do UX Testing, Tech Meeting
How and why you should do UX Testing, Tech Meeting
 
Cro day: converting trial users to paid customers
Cro day: converting trial users to paid customersCro day: converting trial users to paid customers
Cro day: converting trial users to paid customers
 
Optimizely Workshop: Mobile Walkthrough
Optimizely Workshop: Mobile Walkthrough Optimizely Workshop: Mobile Walkthrough
Optimizely Workshop: Mobile Walkthrough
 
Agile Coaching Exchange - Colin Bird 'Maximising Value' Presentation
Agile Coaching Exchange - Colin Bird 'Maximising Value' PresentationAgile Coaching Exchange - Colin Bird 'Maximising Value' Presentation
Agile Coaching Exchange - Colin Bird 'Maximising Value' Presentation
 
Another Basang Basa Coral Beach Resort Episode
Another Basang Basa Coral Beach Resort EpisodeAnother Basang Basa Coral Beach Resort Episode
Another Basang Basa Coral Beach Resort Episode
 
Launch Your Startup Like a Boss
Launch Your Startup Like a BossLaunch Your Startup Like a Boss
Launch Your Startup Like a Boss
 
Presentation to NY Tech Meetup Student Group
Presentation to NY Tech Meetup Student GroupPresentation to NY Tech Meetup Student Group
Presentation to NY Tech Meetup Student Group
 
Sneaking in Good UX Without a UX Budget - WordCamp Chicago 2017 - anthonydpaul
Sneaking in Good UX Without a UX Budget - WordCamp Chicago 2017 - anthonydpaulSneaking in Good UX Without a UX Budget - WordCamp Chicago 2017 - anthonydpaul
Sneaking in Good UX Without a UX Budget - WordCamp Chicago 2017 - anthonydpaul
 
UX Alive Conference speaker is Eileen Chang (Odesk) presentations
UX Alive Conference speaker is Eileen Chang (Odesk) presentationsUX Alive Conference speaker is Eileen Chang (Odesk) presentations
UX Alive Conference speaker is Eileen Chang (Odesk) presentations
 
#INBOUND14 - I've Created My Content, Now What?
#INBOUND14 - I've Created My Content, Now What?#INBOUND14 - I've Created My Content, Now What?
#INBOUND14 - I've Created My Content, Now What?
 
Day22016 mbashort
Day22016 mbashortDay22016 mbashort
Day22016 mbashort
 
Philip Illum Thonbo: Stay humble, start with problems - Digital Commerce at B...
Philip Illum Thonbo: Stay humble, start with problems - Digital Commerce at B...Philip Illum Thonbo: Stay humble, start with problems - Digital Commerce at B...
Philip Illum Thonbo: Stay humble, start with problems - Digital Commerce at B...
 
Marketing Challenges and how to overcome them.
Marketing Challenges and how to overcome them.Marketing Challenges and how to overcome them.
Marketing Challenges and how to overcome them.
 
Marketo + Siftrock
Marketo + SiftrockMarketo + Siftrock
Marketo + Siftrock
 
Lean ing
Lean   ingLean   ing
Lean ing
 

More from Stanfy

Stanfy MadCode Meetup: Анализ и модификация HTTP запросов для тестирования мо...
Stanfy MadCode Meetup: Анализ и модификация HTTP запросов для тестирования мо...Stanfy MadCode Meetup: Анализ и модификация HTTP запросов для тестирования мо...
Stanfy MadCode Meetup: Анализ и модификация HTTP запросов для тестирования мо...
Stanfy
 
Stanfy Publications: How to Conduct Quick Usability Tests for iOS & Android A...
Stanfy Publications: How to Conduct Quick Usability Tests for iOS & Android A...Stanfy Publications: How to Conduct Quick Usability Tests for iOS & Android A...
Stanfy Publications: How to Conduct Quick Usability Tests for iOS & Android A...
Stanfy
 
Stanfy Publications: Mobile Applications UI/UX Prototyping Process
Stanfy Publications: Mobile Applications UI/UX Prototyping ProcessStanfy Publications: Mobile Applications UI/UX Prototyping Process
Stanfy Publications: Mobile Applications UI/UX Prototyping Process
Stanfy
 
Stanfy Publications: Successful Cases of Mobile Technology in Medical Industry
Stanfy Publications: Successful Cases of Mobile Technology in Medical Industry Stanfy Publications: Successful Cases of Mobile Technology in Medical Industry
Stanfy Publications: Successful Cases of Mobile Technology in Medical Industry
Stanfy
 

More from Stanfy (19)

Stanfy MadCode Meetup #11: Why do you need to switch from Obj-C to Swift, or ...
Stanfy MadCode Meetup #11: Why do you need to switch from Obj-C to Swift, or ...Stanfy MadCode Meetup #11: Why do you need to switch from Obj-C to Swift, or ...
Stanfy MadCode Meetup #11: Why do you need to switch from Obj-C to Swift, or ...
 
Avoiding damage, shame and regrets data protection for mobile client-server a...
Avoiding damage, shame and regrets data protection for mobile client-server a...Avoiding damage, shame and regrets data protection for mobile client-server a...
Avoiding damage, shame and regrets data protection for mobile client-server a...
 
Data processing components architecture in mobile applications
Data processing components architecture in mobile applicationsData processing components architecture in mobile applications
Data processing components architecture in mobile applications
 
Data transfer security for mobile apps
Data transfer security for mobile appsData transfer security for mobile apps
Data transfer security for mobile apps
 
Stanfy MadCode Meetup #9: Functional Programming 101 with Swift
Stanfy MadCode Meetup #9: Functional Programming 101 with SwiftStanfy MadCode Meetup #9: Functional Programming 101 with Swift
Stanfy MadCode Meetup #9: Functional Programming 101 with Swift
 
Building Profanity Filters: clbuttic sh!t
Building Profanity Filters: clbuttic sh!tBuilding Profanity Filters: clbuttic sh!t
Building Profanity Filters: clbuttic sh!t
 
Users' Data Security in iOS Applications
Users' Data Security in iOS ApplicationsUsers' Data Security in iOS Applications
Users' Data Security in iOS Applications
 
ComponenKit and React Native
ComponenKit and React NativeComponenKit and React Native
ComponenKit and React Native
 
UX Research in mobile
UX Research in mobileUX Research in mobile
UX Research in mobile
 
Remote user research & usability methods
Remote user research & usability methodsRemote user research & usability methods
Remote user research & usability methods
 
Stanfy MadCode Meetup#6: Apple Watch. First Steps.
Stanfy MadCode Meetup#6: Apple Watch. First Steps.Stanfy MadCode Meetup#6: Apple Watch. First Steps.
Stanfy MadCode Meetup#6: Apple Watch. First Steps.
 
Stanfy MadCode Meetup: Анализ и модификация HTTP запросов для тестирования мо...
Stanfy MadCode Meetup: Анализ и модификация HTTP запросов для тестирования мо...Stanfy MadCode Meetup: Анализ и модификация HTTP запросов для тестирования мо...
Stanfy MadCode Meetup: Анализ и модификация HTTP запросов для тестирования мо...
 
Stanfy's highlights of 2013
Stanfy's highlights of 2013Stanfy's highlights of 2013
Stanfy's highlights of 2013
 
10 things to consider when choosing a mobile platform (iOS or Android)
10 things to consider when choosing a mobile platform (iOS or Android)10 things to consider when choosing a mobile platform (iOS or Android)
10 things to consider when choosing a mobile platform (iOS or Android)
 
Stanfy Publications: How to Conduct Quick Usability Tests for iOS & Android A...
Stanfy Publications: How to Conduct Quick Usability Tests for iOS & Android A...Stanfy Publications: How to Conduct Quick Usability Tests for iOS & Android A...
Stanfy Publications: How to Conduct Quick Usability Tests for iOS & Android A...
 
Stanfy Publications: Mobile Applications UI/UX Prototyping Process
Stanfy Publications: Mobile Applications UI/UX Prototyping ProcessStanfy Publications: Mobile Applications UI/UX Prototyping Process
Stanfy Publications: Mobile Applications UI/UX Prototyping Process
 
Stanfy Publications: Successful Cases of Mobile Technology in Medical Industry
Stanfy Publications: Successful Cases of Mobile Technology in Medical Industry Stanfy Publications: Successful Cases of Mobile Technology in Medical Industry
Stanfy Publications: Successful Cases of Mobile Technology in Medical Industry
 
Android Developer Days: Increasing performance of big arrays processing on An...
Android Developer Days: Increasing performance of big arrays processing on An...Android Developer Days: Increasing performance of big arrays processing on An...
Android Developer Days: Increasing performance of big arrays processing on An...
 
Fitness In Mobile: A Case Study.
Fitness In Mobile: A Case Study. Fitness In Mobile: A Case Study.
Fitness In Mobile: A Case Study.
 

Recently uploaded

Obat Penggugur Kandungan Di Apotik Kimia Farma (087776558899)
Obat Penggugur Kandungan Di Apotik Kimia Farma (087776558899)Obat Penggugur Kandungan Di Apotik Kimia Farma (087776558899)
Obat Penggugur Kandungan Di Apotik Kimia Farma (087776558899)
Cara Menggugurkan Kandungan 087776558899
 

Recently uploaded (6)

Mobile Application Development-Components and Layouts
Mobile Application Development-Components and LayoutsMobile Application Development-Components and Layouts
Mobile Application Development-Components and Layouts
 
Satara Call girl escort *74796//13122* Call me punam call girls 24*7hour avai...
Satara Call girl escort *74796//13122* Call me punam call girls 24*7hour avai...Satara Call girl escort *74796//13122* Call me punam call girls 24*7hour avai...
Satara Call girl escort *74796//13122* Call me punam call girls 24*7hour avai...
 
Mobile App Penetration Testing Bsides312
Mobile App Penetration Testing Bsides312Mobile App Penetration Testing Bsides312
Mobile App Penetration Testing Bsides312
 
Android Application Components with Implementation & Examples
Android Application Components with Implementation & ExamplesAndroid Application Components with Implementation & Examples
Android Application Components with Implementation & Examples
 
Obat Penggugur Kandungan Di Apotik Kimia Farma (087776558899)
Obat Penggugur Kandungan Di Apotik Kimia Farma (087776558899)Obat Penggugur Kandungan Di Apotik Kimia Farma (087776558899)
Obat Penggugur Kandungan Di Apotik Kimia Farma (087776558899)
 
Mobile Application Development-Android and It’s Tools
Mobile Application Development-Android and It’s ToolsMobile Application Development-Android and It’s Tools
Mobile Application Development-Android and It’s Tools
 

Optimistic Approach. How to show results instead spinners without breaking your application.

  • 1. 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
  • 2. Optimistic Approach What is it about? Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 2
  • 3. 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
  • 4. How mobile application works Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 4
  • 5. 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
  • 6. Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 6
  • 7. User need to wait Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 7
  • 8. 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
  • 9. 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
  • 10. Loading next slide Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 10
  • 11. Solutions? Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 11
  • 12. 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
  • 13. 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
  • 14. Solutions - Entertain user Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 14
  • 15. 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
  • 16. 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
  • 17. 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
  • 18. Types of user interactions Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 18
  • 19. Actions and Expectations Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 19
  • 20. 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
  • 21. Predictabevs *elbatciderpnU_ Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 21
  • 22. Predictable Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 22
  • 23. 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
  • 24. Optimistic models Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 24
  • 25. Non optimistic model Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 25
  • 26. Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 26
  • 27. Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 27
  • 28. 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
  • 29. 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
  • 30. 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
  • 31. 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
  • 32. What about non-breaking? Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 32
  • 33. Correct View Layer MVVM* Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 33
  • 34. Correct View Layer Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 34
  • 35. Correct View Layer Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 35
  • 36. Hiperactive User? Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 36
  • 37. 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
  • 38. State based on multiple updates Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 38
  • 39. 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
  • 40. Demo?Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 40
  • 41. Recap Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 41
  • 42. 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
  • 43. Last slide :) Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 43
  • 44. 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
  • 45. 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
  • 46. Paul Taykalo, Optimistic Approach : How to show results instead spinners without breaking your Application, Stanfy, 2015 46