Upgrade to Pro — share decks privately, control downloads, hide ads and more …

For Optimists, our UI is pretty Pessimistic

For Optimists, our UI is pretty Pessimistic

In a lot of applications, users are constantly performing operations that require some form of communication with a server. Whether it’s the loading of content, the sending of a message or the changing of setting – how many times have you used an app that has made you watch a progress bar whilst such an operation has been taking place. For me, too many times. This kind of experience is blocking for the user and in a world where slow network connectivity is still common in some places, it’s very likely that you’re slowing down many users when using your app. This is a pessimistic approach to crafting – the fear of not quite knowing whether what is being done is going to be successful.

But really, it’s not even too big a task to design and build for optimism over pessimism. Crafting for optimism allow us to behave as though the best outcome is going to occur but still falling back to another state if something does happen to go wrong. In this talk, we’ll be looking at exactly how we can use a mixture of offline tactics and optimistic UI states to avoid signs of pessimism in our UI and craft a more positive experience for our users.

Joe Birch

July 14, 2017
Tweet

More Decks by Joe Birch

Other Decks in Programming

Transcript

  1. For Optimists, our UI is pretty Pessimistic Joe Birch -

    Android Engineer @ Buffer @hitherejoe
  2. Talk Outline What are Pessimistic & Optimistic UIs Why Pessimistic

    UIs are used and the disadvantages An example of where and how Optimism can be applied to UIs Handling errors in Optimistic UIs How Optimistic UI implementations and Offline support meet
  3. The quality of being full of hope and emphasising the

    good parts of a situation, or a belief that something good will happen. Optimism Confidence, hopefulness, cheerfulness. Synonyms
  4. Emphasising or thinking of the bad part of a situation

    rather than the good part, or the feeling that bad things are more likely to happen than good things. Pessimism Synonyms Distrust, hopelessness, Discouragement.
  5. But why so much pessimism? It’s a predictable behaviour for

    the user It gives us an error proof implementation for interactions It’s easier to implement than other solutions
  6. Issues with pessimistic approach User has to wait for requests

    to complete. Removing the ability to multitask while other requests are completing These delays make our application feel like it’s operating slowly, reflecting badly on both our application and business
  7. 100 milliseconds The delay between depressing the key' and the

    visual feedback should be no more than 0.1 to 0.2 seconds
  8. Passive waiting Most people blink around 15 times a minute

    and a blink lasts on average 100-150 milliseconds
  9. But isn’t this cheating? Are we not lying to the

    users about the result of the request
  10. class SomeIntentService: IntentService { @Override fun onHandleIntent(intent: Intent) { …

    } return START_REDELIVER_INTENT } Intent Service Launch background service to perform a task
  11. val jobScheduler = getSystemService(JOB_SCHEDULER_SERVICE); val componentName = ComponentName(this, SomeJobService); val

    jobInfo = JobInfo.Builder(12, componentName) .setOverrideDeadline(3 * 1000) .setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY) .build(); jobScheduler.schedule(jobInfo) Job Scheduler Schedule tasks based on given conditions
  12. But why schedule jobs? System can batch jobs together, reducing

    power consumption Task may not be critical or required to be ‘posted’ instantly Wait on specific conditions to be satisfied Repeat tasks if required
  13. Manipulate local data during request Manipulate data locally when a

    request takes place and have the UI reactively reflect this Database / Adapter
  14. Manipulate local data and sync Manipulate data locally first and

    have the UI reflect this, sync this with the server Server Database
  15. Avoid Stop using using blocking components Cache data where possible

    and make use of it! If not syncing, react to actions locally and handle response. Otherwise, manipulate data locally and sync with server Design for Optimism, Hope for the best, deal with an error if it happens To conclude…