Top Banner
CUTTING THE FAT When to use Ajax and when to reload
103

Cutting the Fat by Tiffany Conroy

May 17, 2015

Download

Technology

Codemotion

Rich, interactive web applications AKA fat clients are now commonplace. There are so many frameworks for building these rich client applications, and the debate among developers is which of these frameworks to use. As designers and developers we need to step back, and ask ourselves when and how we should enrich our client applications and when or why not. Let's dig in to the question: Why do we even want fat clients, and when should we use them? Let's examine the complications such clients introduce so we can weigh them against all the benefits.
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Cutting the Fat by Tiffany Conroy

CUTTING THE FATWhen to use Ajax and when to reload

Page 2: Cutting the Fat by Tiffany Conroy

@theophani

TIFFANY CONROY

All content licensed under http://creativecommons.org/licenses/by-nc-sa/3.0/

My name is Tiffany, and I work as an interaction designer and front-end developer at SoundCloud.

Page 3: Cutting the Fat by Tiffany Conroy

CUTTING THE FATWhen to use Ajax and when to reload

When to use Ajax and when to reload=======================

This is a talk about being pragmatic.

This is a talk is about how to reduce the technical complexity of web applications.

This talk is about using interaction design to help make the choice between using Ajax and reloading the page.

Page 4: Cutting the Fat by Tiffany Conroy

Last summer there was a conference called “Throne of JS”

The conference had a very specific premise:

Page 5: Cutting the Fat by Tiffany Conroy

“Throne of JS … is … focused on answering the question on every web developer’s mind:

“Throne of JS is […] focused on answering the question on every web developer's mind: which framework?”

Yes: rich, interactive web applications are now commonplace. There are so many frameworks for building these rich client applications, and the debate among developers is which of these frameworks to use.

Page 6: Cutting the Fat by Tiffany Conroy

“Throne of JS … is … focused on answering the question on every web developer’s mind:which framework?”

“Throne of JS is […] focused on answering the question on every web developer's mind: which framework?”

Yes: rich, interactive web applications are now commonplace. There are so many frameworks for building these rich client applications, and the debate among developers is which of these frameworks to use.

Page 7: Cutting the Fat by Tiffany Conroy

Question the premise.

The premise of the question “which framework” is based on the idea that in a modern web application, the page should never be reloaded.

But as designers and developers, we need to step back, and ask ourselves: why don’t we want to reload the page? When *can* we reload the page, and What is the benefit of Ajax? What is the cost of using Ajax?

Frameworks help up to solve technical problems, but can we ever avoid those problems entirely?

Page 8: Cutting the Fat by Tiffany Conroy

What to expect

First I’m going to define some terminology.Then we examine the benefits and problems of fancy single-page web applications.Lastly, I want to show you one way of approaching your applications as a designer and developer that can help you reduce complexity, even before you choose a framework.

Let’s get started.

Page 9: Cutting the Fat by Tiffany Conroy

What to expect• Terminology

First I’m going to define some terminology.Then we examine the benefits and problems of fancy single-page web applications.Lastly, I want to show you one way of approaching your applications as a designer and developer that can help you reduce complexity, even before you choose a framework.

Let’s get started.

Page 10: Cutting the Fat by Tiffany Conroy

What to expect• Terminology• Benefits and costs of Ajax

First I’m going to define some terminology.Then we examine the benefits and problems of fancy single-page web applications.Lastly, I want to show you one way of approaching your applications as a designer and developer that can help you reduce complexity, even before you choose a framework.

Let’s get started.

Page 11: Cutting the Fat by Tiffany Conroy

What to expect• Terminology• Benefits and costs of Ajax• A pragmatic approach

First I’m going to define some terminology.Then we examine the benefits and problems of fancy single-page web applications.Lastly, I want to show you one way of approaching your applications as a designer and developer that can help you reduce complexity, even before you choose a framework.

Let’s get started.

Page 12: Cutting the Fat by Tiffany Conroy

AJAX vs RELOAD

A quick recap for everyone on what Ajax is and what we use it for, and how it differs from a page reload.

Page 13: Cutting the Fat by Tiffany Conroy

In the early 90s, all web pages were static, and if you wanted to see new content, you followed a link or clicked on a form submit button …

Page 14: Cutting the Fat by Tiffany Conroy

In the early 90s, all web pages were static, and if you wanted to see new content, you followed a link or clicked on a form submit button …

… and the whole page would reload.

Page 15: Cutting the Fat by Tiffany Conroy

Whole page reloads

In the early 90s, all web pages were static, and if you wanted to see new content, you followed a link or clicked on a form submit button …

… and the whole page would reload.

Page 16: Cutting the Fat by Tiffany Conroy

In the second half of the 90s …

Page 17: Cutting the Fat by Tiffany Conroy

JavaScript

… after JavaScript was introduced, a JavaScript object called …

Page 18: Cutting the Fat by Tiffany Conroy

JavaScript

andXMLHttpRequest

… XMLHttpRequest was introduced, which allowed content to be sent and loaded …

Page 19: Cutting the Fat by Tiffany Conroy

AsynchronousJavaScript

andXMLHttpRequest

asynchronously, without reloading the whole page.

Page 20: Cutting the Fat by Tiffany Conroy

AsynchronousJavaScript

andXMLHttpRequest

In 2005, the technique of loading content asynchronously with JavaScript was given the name Ajax. Around that time Google released Gmail and Google Maps.

(ps to big know-it-alls reading these speaker notes: yes, I know the X originally stood for XML, but making that distinction would just complicate things.)

Page 21: Cutting the Fat by Tiffany Conroy

Just one partreloads

Ajax allowed us to change the page content without a full page reload.

But the more exciting use case was to make the page send and load content based on user interaction.

Page 22: Cutting the Fat by Tiffany Conroy

Let’s look at an example using Facebook messages.

Page 23: Cutting the Fat by Tiffany Conroy

I start to type a reply.

Page 24: Cutting the Fat by Tiffany Conroy

In my reply, I enter a web address.

Page 25: Cutting the Fat by Tiffany Conroy

Without me doing anything, and without interrupting me typing, the Facebook app uses Ajax to load information about the link I entered, and adds it to my message.

Page 26: Cutting the Fat by Tiffany Conroy

When I send the message, the app uses Ajax to send my message without reloading the page.

Ajax allowed us to maintain the context of what the user was doing, without reloading the page.

Page 27: Cutting the Fat by Tiffany Conroy

Ajax → maintains context

The web stopped being a collection of static web sites with fixed content, and allowed us to exchange data with the web server without reloading the page.

Now, we rely heavily on Ajax to control the user's experience.

To reiterate what I said before:

Ajax allows us to maintain the context of what the user was doing, without reloading the page.

Page 28: Cutting the Fat by Tiffany Conroy

CONTEXT

What do I mean by “context”?

Page 29: Cutting the Fat by Tiffany Conroy

“Context” is the answer to the question: where are you, and what are you doing. By this I am not talking about where you physically are while using a web application, but where you are *within* the web application, and what you are doing there.

Page 30: Cutting the Fat by Tiffany Conroy

User Profile

NewsFeed

StoreCheckout

Slideshow

Some examples of different contexts could be:user profile, a news feed, the checkout of a store, a slideshow.

Within each of these contexts, we may not want to reload the page.

Each distinct context could be its own “single-page app”, and a plain old browser refresh could be used to transition between these contexts.

Page 31: Cutting the Fat by Tiffany Conroy

But two different instances of the same “screen” are in fact two different contexts.

For example: The timeline of two different people are two different contexts.

Page 32: Cutting the Fat by Tiffany Conroy

Two separate contextsBut two different instances of the same “screen” are in fact two different contexts.

For example: The timeline of two different people are two different contexts.

Page 33: Cutting the Fat by Tiffany Conroy

Multiple parts of the same workflow can all happen in the same context.

In this example, the context is filling out a form. While the user is in this context, we want to control the user’s experience as much as possible, so that the user doesn’t lose context.

Page 34: Cutting the Fat by Tiffany Conroy

Same contextMultiple parts of the same workflow can all happen in the same context.

In this example, the context is filling out a form. While the user is in this context, we want to control the user’s experience as much as possible, so that the user doesn’t lose context.

Page 35: Cutting the Fat by Tiffany Conroy

Your application may have lots of little components and features and bits of information, and you need to understand out how they all relate to each other.

Page 36: Cutting the Fat by Tiffany Conroy

Then you need to define which components go together.

Page 37: Cutting the Fat by Tiffany Conroy

Then you need to define which components go together.

Page 38: Cutting the Fat by Tiffany Conroy

So when I say a context, I mean these different groupings of related bits organized into meaningful groupings.

Designers need to understand, define and communicate the distinct contexts in any rich web application, being clear about the where boundaries between contexts are; where one stops and the next one starts.

Page 39: Cutting the Fat by Tiffany Conroy

When we make a transition from one context to the next, we exit the boundary of one context and enter another.

Ajax could be used to control the transition between contexts, if the designer and the developer can negotiate it by balancing the benefits against the technical costs.

Page 40: Cutting the Fat by Tiffany Conroy

Designers need to understand, define and communicate the distinct contexts in any rich web application, being clear about the where boundaries between contexts are; where one stops and the next one starts.

Page 41: Cutting the Fat by Tiffany Conroy

Ajax → maintains context

So, Ajax allows us to maintain context for users.

Page 42: Cutting the Fat by Tiffany Conroy

Lots of Ajax → “Fat Client”

Web applications that use a lot of Ajax are sometimes called “fat client”

Page 43: Cutting the Fat by Tiffany Conroy

FAT vs THINWhat is a “fat” client?

What do we mean by a “fat client”.How is it different from a “thin client”

Page 44: Cutting the Fat by Tiffany Conroy

Client = code in the browser

SERVER ----[ network ]----> CLIENT

## Server and client

In this discussion, the code that runs in a web browser is the “client”, in contrast with code that runs on a web server.

Page 45: Cutting the Fat by Tiffany Conroy

Thin client

DATA + ALL THE LOGIC-------------------[ network ]---------------->

PRESENTATION

## Thin Client

[ DATA ] + [ ALL THE LOGIC ] ----[network]----> [PRESENTATION]

All the logic is performed on the server-side.

Static pages that rely on page reload are THIN. The browser, AKA the client, just displays the content.

Page 46: Cutting the Fat by Tiffany Conroy

Fat client

DATA-------------------[ network ]---------------->

ALL THE LOGIC + PRESENTATION

## Fat Client

[ DATA ] + [ ALL THE LOGIC ] ----[network]----> [PRESENTATION]

All the logic is performed on the client-side.

The server sends static content over the network, and all the logic is done in the browser AKA the client.

These fat clients rely on a lot of JavaScript and Ajax.

Page 47: Cutting the Fat by Tiffany Conroy

“Native Experience”

People also talk about a “native experience” on the web.

Ajax allows us to emulate a “native experience” on the web, meaning, it feels like an application not a web site.

Page 48: Cutting the Fat by Tiffany Conroy

“Native Experience”and controlling transitions

One of the most basic features of a ”native” experience is the controlled transitions between contexts, for example, the sliding left and right between screens.

On the web, if you reload the page, you can’t define the transition. In every browser I’ve used, the transition is the same: the page goes white, the spinner spins, and then the page loads. Reloading can be jarring.

We can get around this if we load the content with Ajax, and then transition to the new context. We call these sort of sites that exclusively use Ajax “single-page apps”.

Page 49: Cutting the Fat by Tiffany Conroy

SINGLE-PAGE APPSAwesome or not awesome?

So called “single-page apps” are very sexy these days. But people have begun to see that single-page apps are also nasty beasts that bring all sorts of technical complications with them.

Page 50: Cutting the Fat by Tiffany Conroy

SINGLE-PAGE APPS

Trying to recreate a native experience brings with it all kinds of technical problems.

One upon a time, if the URL in the browser changed, the page reloaded.

As we made rich applications using Ajax, we ran into the problem that we could reach a state in the application that we could not link to. We started to talk about how to “deep-link” to a context within an application.

This wasn’t (usually) a problem before we started using Ajax.

Page 51: Cutting the Fat by Tiffany Conroy

SINGLE-PAGE APPS

back button

Trying to recreate a native experience brings with it all kinds of technical problems.

One upon a time, if the URL in the browser changed, the page reloaded.

As we made rich applications using Ajax, we ran into the problem that we could reach a state in the application that we could not link to. We started to talk about how to “deep-link” to a context within an application.

This wasn’t (usually) a problem before we started using Ajax.

Page 52: Cutting the Fat by Tiffany Conroy

SINGLE-PAGE APPS

deep-linking

back button

Trying to recreate a native experience brings with it all kinds of technical problems.

One upon a time, if the URL in the browser changed, the page reloaded.

As we made rich applications using Ajax, we ran into the problem that we could reach a state in the application that we could not link to. We started to talk about how to “deep-link” to a context within an application.

This wasn’t (usually) a problem before we started using Ajax.

Page 53: Cutting the Fat by Tiffany Conroy

SINGLE-PAGE APPS

deep-linking

#! hash-bang

back button

Trying to recreate a native experience brings with it all kinds of technical problems.

One upon a time, if the URL in the browser changed, the page reloaded.

As we made rich applications using Ajax, we ran into the problem that we could reach a state in the application that we could not link to. We started to talk about how to “deep-link” to a context within an application.

This wasn’t (usually) a problem before we started using Ajax.

Page 54: Cutting the Fat by Tiffany Conroy

SINGLE-PAGE APPS

deep-linking

JavaScript router

#! hash-bang

back button

Trying to recreate a native experience brings with it all kinds of technical problems.

One upon a time, if the URL in the browser changed, the page reloaded.

As we made rich applications using Ajax, we ran into the problem that we could reach a state in the application that we could not link to. We started to talk about how to “deep-link” to a context within an application.

This wasn’t (usually) a problem before we started using Ajax.

Page 55: Cutting the Fat by Tiffany Conroy

SINGLE-PAGE APPS

deep-linking

JavaScript router

#! hash-bang

back button

window.history

Trying to recreate a native experience brings with it all kinds of technical problems.

One upon a time, if the URL in the browser changed, the page reloaded.

As we made rich applications using Ajax, we ran into the problem that we could reach a state in the application that we could not link to. We started to talk about how to “deep-link” to a context within an application.

This wasn’t (usually) a problem before we started using Ajax.

Page 56: Cutting the Fat by Tiffany Conroy

SINGLE-PAGE APPS

deep-linking

JavaScript router

#! hash-bang

back button

frameworks

window.history

Trying to recreate a native experience brings with it all kinds of technical problems.

One upon a time, if the URL in the browser changed, the page reloaded.

As we made rich applications using Ajax, we ran into the problem that we could reach a state in the application that we could not link to. We started to talk about how to “deep-link” to a context within an application.

This wasn’t (usually) a problem before we started using Ajax.

Page 57: Cutting the Fat by Tiffany Conroy

Let’s pause for a moment:

Why do we want to use Ajax?

What problems are we trying to solve with Ajax? i.e. what **benefits** do we gain from using it?

Page 58: Cutting the Fat by Tiffany Conroy

Problems a fat client solves:

Problems a fat client solves:

* The user can continue to interact (including simply viewing) while data is exchanged.

* The designer can customize and control the loading and transition experience between contexts.

* Information can be presented in a partial, incremental, incomplete form, thus context can be established while further information is retrieved. (Like a pan in a film, setting can be established in advance of details.)

* The traffic between server and client can be reduced to data separate from the presentation, reducing network use and speeding up information transmission.

Most of these are design problems. Even improved speed would result in a better experience for people.

Page 59: Cutting the Fat by Tiffany Conroy

Problems a fat client solves:• Continuous interaction

Problems a fat client solves:

* The user can continue to interact (including simply viewing) while data is exchanged.

* The designer can customize and control the loading and transition experience between contexts.

* Information can be presented in a partial, incremental, incomplete form, thus context can be established while further information is retrieved. (Like a pan in a film, setting can be established in advance of details.)

* The traffic between server and client can be reduced to data separate from the presentation, reducing network use and speeding up information transmission.

Most of these are design problems. Even improved speed would result in a better experience for people.

Page 60: Cutting the Fat by Tiffany Conroy

Problems a fat client solves:• Continuous interaction• Transitions between contexts

Problems a fat client solves:

* The user can continue to interact (including simply viewing) while data is exchanged.

* The designer can customize and control the loading and transition experience between contexts.

* Information can be presented in a partial, incremental, incomplete form, thus context can be established while further information is retrieved. (Like a pan in a film, setting can be established in advance of details.)

* The traffic between server and client can be reduced to data separate from the presentation, reducing network use and speeding up information transmission.

Most of these are design problems. Even improved speed would result in a better experience for people.

Page 61: Cutting the Fat by Tiffany Conroy

Problems a fat client solves:• Continuous interaction• Transitions between contexts• Incremental loading

Problems a fat client solves:

* The user can continue to interact (including simply viewing) while data is exchanged.

* The designer can customize and control the loading and transition experience between contexts.

* Information can be presented in a partial, incremental, incomplete form, thus context can be established while further information is retrieved. (Like a pan in a film, setting can be established in advance of details.)

* The traffic between server and client can be reduced to data separate from the presentation, reducing network use and speeding up information transmission.

Most of these are design problems. Even improved speed would result in a better experience for people.

Page 62: Cutting the Fat by Tiffany Conroy

Problems a fat client solves:• Continuous interaction• Transitions between contexts• Incremental loading• Reduced network traffic

Problems a fat client solves:

* The user can continue to interact (including simply viewing) while data is exchanged.

* The designer can customize and control the loading and transition experience between contexts.

* Information can be presented in a partial, incremental, incomplete form, thus context can be established while further information is retrieved. (Like a pan in a film, setting can be established in advance of details.)

* The traffic between server and client can be reduced to data separate from the presentation, reducing network use and speeding up information transmission.

Most of these are design problems. Even improved speed would result in a better experience for people.

Page 63: Cutting the Fat by Tiffany Conroy

Problems a fat client solves:• Continuous interaction• Transitions between contexts• Incremental loading• Reduced network traffic

→ DESIGN PROBLEMS (mostly)

Problems a fat client solves:

* The user can continue to interact (including simply viewing) while data is exchanged.

* The designer can customize and control the loading and transition experience between contexts.

* Information can be presented in a partial, incremental, incomplete form, thus context can be established while further information is retrieved. (Like a pan in a film, setting can be established in advance of details.)

* The traffic between server and client can be reduced to data separate from the presentation, reducing network use and speeding up information transmission.

Most of these are design problems. Even improved speed would result in a better experience for people.

Page 64: Cutting the Fat by Tiffany Conroy

Problems a fat client causes:

Problems a fat client causes:

* Routing becomes the responsibility of the client-side script instead of the browser --> deep-linking

* History management becomes the responsibility of the client-side script instead of the browser --> back button

* Caching (what and for how long) becomes the responsibility of the client-side script instead of the browser --> reusing previously-fetched data and templates to achieve improved speed

* Improvements from the speedy transmission are eroded by computation within the client i.e. instead of doing computation in an environment we can control (the server) we push it to the client, which is notoriously out of our control.

These are technical problems. From a design perspective, these become trade-offs that are “someone else’s problem”.

Page 65: Cutting the Fat by Tiffany Conroy

Problems a fat client causes:• Routing

Problems a fat client causes:

* Routing becomes the responsibility of the client-side script instead of the browser --> deep-linking

* History management becomes the responsibility of the client-side script instead of the browser --> back button

* Caching (what and for how long) becomes the responsibility of the client-side script instead of the browser --> reusing previously-fetched data and templates to achieve improved speed

* Improvements from the speedy transmission are eroded by computation within the client i.e. instead of doing computation in an environment we can control (the server) we push it to the client, which is notoriously out of our control.

These are technical problems. From a design perspective, these become trade-offs that are “someone else’s problem”.

Page 66: Cutting the Fat by Tiffany Conroy

Problems a fat client causes:• Routing• History

Problems a fat client causes:

* Routing becomes the responsibility of the client-side script instead of the browser --> deep-linking

* History management becomes the responsibility of the client-side script instead of the browser --> back button

* Caching (what and for how long) becomes the responsibility of the client-side script instead of the browser --> reusing previously-fetched data and templates to achieve improved speed

* Improvements from the speedy transmission are eroded by computation within the client i.e. instead of doing computation in an environment we can control (the server) we push it to the client, which is notoriously out of our control.

These are technical problems. From a design perspective, these become trade-offs that are “someone else’s problem”.

Page 67: Cutting the Fat by Tiffany Conroy

Problems a fat client causes:• Routing• History• Caching and garbage collection

Problems a fat client causes:

* Routing becomes the responsibility of the client-side script instead of the browser --> deep-linking

* History management becomes the responsibility of the client-side script instead of the browser --> back button

* Caching (what and for how long) becomes the responsibility of the client-side script instead of the browser --> reusing previously-fetched data and templates to achieve improved speed

* Improvements from the speedy transmission are eroded by computation within the client i.e. instead of doing computation in an environment we can control (the server) we push it to the client, which is notoriously out of our control.

These are technical problems. From a design perspective, these become trade-offs that are “someone else’s problem”.

Page 68: Cutting the Fat by Tiffany Conroy

Problems a fat client causes:• Routing• History• Caching and garbage collection• Computation is outside of our control

Problems a fat client causes:

* Routing becomes the responsibility of the client-side script instead of the browser --> deep-linking

* History management becomes the responsibility of the client-side script instead of the browser --> back button

* Caching (what and for how long) becomes the responsibility of the client-side script instead of the browser --> reusing previously-fetched data and templates to achieve improved speed

* Improvements from the speedy transmission are eroded by computation within the client i.e. instead of doing computation in an environment we can control (the server) we push it to the client, which is notoriously out of our control.

These are technical problems. From a design perspective, these become trade-offs that are “someone else’s problem”.

Page 69: Cutting the Fat by Tiffany Conroy

Problems a fat client causes:• Routing• History• Caching and garbage collection• Computation is outside of our control

→ TECHNICAL PROBLEMS

Problems a fat client causes:

* Routing becomes the responsibility of the client-side script instead of the browser --> deep-linking

* History management becomes the responsibility of the client-side script instead of the browser --> back button

* Caching (what and for how long) becomes the responsibility of the client-side script instead of the browser --> reusing previously-fetched data and templates to achieve improved speed

* Improvements from the speedy transmission are eroded by computation within the client i.e. instead of doing computation in an environment we can control (the server) we push it to the client, which is notoriously out of our control.

These are technical problems. From a design perspective, these become trade-offs that are “someone else’s problem”.

Page 70: Cutting the Fat by Tiffany Conroy

Design problems afat client solves:

Let’s look again at the interaction design problems that a fat client can solve.

Page 71: Cutting the Fat by Tiffany Conroy

Design problems afat client solves:• Continuous interaction

Let’s look again at the interaction design problems that a fat client can solve.

Page 72: Cutting the Fat by Tiffany Conroy

Design problems afat client solves:• Continuous interaction• Transitions between contexts

Let’s look again at the interaction design problems that a fat client can solve.

Page 73: Cutting the Fat by Tiffany Conroy

Design problems afat client solves:• Continuous interaction• Transitions between contexts• Incremental loading

Let’s look again at the interaction design problems that a fat client can solve.

Page 74: Cutting the Fat by Tiffany Conroy

Design problems afat client solves:• Continuous interaction• Transitions between contexts• Incremental loading

Let’s look again at the interaction design problems that a fat client can solve.

Page 75: Cutting the Fat by Tiffany Conroy

Design problems afat client solves:• Continuous interaction• Transitions between contexts• Incremental loading

Maintain context

Let’s look again at the interaction design problems that a fat client can solve.

Page 76: Cutting the Fat by Tiffany Conroy

Design problems afat client solves:• Continuous interaction• Transitions between contexts• Incremental loading

Maintain context

Let’s look again at the interaction design problems that a fat client can solve.

Page 77: Cutting the Fat by Tiffany Conroy

Design problems afat client solves:• Continuous interaction• Transitions between contexts• Incremental loading

Maintain context

Establish contextLet’s look again at the interaction design problems that a fat client can solve.

Page 78: Cutting the Fat by Tiffany Conroy

Ajax → controls context

Ajax allows us to establish and maintain the context for the user, without jarring reloads.

BUT …

Page 79: Cutting the Fat by Tiffany Conroy

Ajax → adds complexity

Ajax also introduces all lot of technical complications.

This is complication that you as designer don’t have to think about, but creates a lot of extra work for developers.

And that extra work might not be worth it. How can designers help developers be pragmatic about when to use Ajax and when not to?

Page 80: Cutting the Fat by Tiffany Conroy

Design problems afat client solves:• Continuous interaction• Transitions between contexts• Incremental loading

When we look at the problems that a fat client can solve, we can ask which one is the most important?

-> Continuous interaction is the primary reason we use Ajax. We use it during form validation, live chatting, commenting while watching a video

Page 81: Cutting the Fat by Tiffany Conroy

Design problems afat client solves:• Continuous interaction• Transitions between contexts• Incremental loading

Most important

When we look at the problems that a fat client can solve, we can ask which one is the most important?

-> Continuous interaction is the primary reason we use Ajax. We use it during form validation, live chatting, commenting while watching a video

Page 82: Cutting the Fat by Tiffany Conroy

Design problems afat client solves:• Continuous interaction• Transitions between contexts• Incremental loading

Most important

When we look at the problems that a fat client can solve, we can ask which one is the most important?

-> Continuous interaction is the primary reason we use Ajax. We use it during form validation, live chatting, commenting while watching a video

Page 83: Cutting the Fat by Tiffany Conroy

Continuous interaction

Continuous interaction is the primary reason we use Ajax. We use it during form validation, live chatting, commenting while watching a video, performing a search.

Page 84: Cutting the Fat by Tiffany Conroy

Design problems afat client solves:• Continuous interaction• Transitions between contexts• Incremental loading

So what benefit of Ajax is the least important?

-> Transitions between contexts

Page 85: Cutting the Fat by Tiffany Conroy

Design problems afat client solves:• Continuous interaction• Transitions between contexts• Incremental loading

Least important

So what benefit of Ajax is the least important?

-> Transitions between contexts

Page 86: Cutting the Fat by Tiffany Conroy

Design problems afat client solves:• Continuous interaction• Transitions between contexts• Incremental loading

Least important

So what benefit of Ajax is the least important?

-> Transitions between contexts

Page 87: Cutting the Fat by Tiffany Conroy

New context? → Reload!

When the user switches to a new context, the page can just be reloaded.

Page 88: Cutting the Fat by Tiffany Conroy

NO TRANSITIONS!?

What about transitions?

Transition are nice to have but not essential for most cases.

Page 89: Cutting the Fat by Tiffany Conroy

“The cool kids are doing it!”

You might say:

BUT BUT BUT … all the cool kids are doing it! My product is also cool!

Maybe, but some of the cool kids still use page reload.

Page 90: Cutting the Fat by Tiffany Conroy

Case study: Github

Page 91: Cutting the Fat by Tiffany Conroy

On github.com: a profile is a context, the repo file-browser is a context, and each pull request is one context, with page reloads in between.

Page 92: Cutting the Fat by Tiffany Conroy

On github.com: a profile is a context, the repo file-browser is a context, and each pull request is one context, with page reloads in between.

Page 93: Cutting the Fat by Tiffany Conroy

As we saw, Github is a collection of single-page apps, one per context, with page reloads in between.

Page 94: Cutting the Fat by Tiffany Conroy

AJAX vs RELOAD?

So, when should you use Ajax and when should you use reload?

Let’s recap:

Page 95: Cutting the Fat by Tiffany Conroy

Limit your demand for Ajax

Limit your demand for asynchronous communication to only within the contexts that matter. Only use it when you can afford it.

“Single-page apps” are often made as single-page apps for the wrong reasons. I have made this mistake.

Where is our need for Ajax? -- at the interaction points.

Page 96: Cutting the Fat by Tiffany Conroy

Find the interaction points

Find the interaction points. Everywhere the user will click, type, hover or otherwise engage with the interface.

For each, ask: what benefit vs cost does Ajax have at that interaction point? Can we afford the cost? Where can we eliminate our need for Ajax?

Page 97: Cutting the Fat by Tiffany Conroy

Find the context boundaries

Know where the boundaries between contexts are, and communicate them to developers, because these are important for designing the application architecture.

Using Ajax in at these interaction points give us the least benefit.

Lastly, for developers:

Page 98: Cutting the Fat by Tiffany Conroy

Does your frameworkminimize your technical costs?

Does your framework help solve the design problems while minimizing the technical costs?

Page 99: Cutting the Fat by Tiffany Conroy

Single-page apps? YES: we can help our users maintain context so they can focus without jarring interruptions. These means: use Ajax for each context, and each of those is its own single-page app.

Monolithic apps? NO: or at least, they aren’t nearly as useful as they are technically hard, and you should be very clear of the costs. You may get so much benefit, or have so many people working in the problems, that you can overcome the costs. Your *entire web app* does *not* need to be one single front-end app.

Page 100: Cutting the Fat by Tiffany Conroy

Single-page apps? → YES

Single-page apps? YES: we can help our users maintain context so they can focus without jarring interruptions. These means: use Ajax for each context, and each of those is its own single-page app.

Monolithic apps? NO: or at least, they aren’t nearly as useful as they are technically hard, and you should be very clear of the costs. You may get so much benefit, or have so many people working in the problems, that you can overcome the costs. Your *entire web app* does *not* need to be one single front-end app.

Page 101: Cutting the Fat by Tiffany Conroy

Single-page apps? → YES

Monolithic apps? → NO

Single-page apps? YES: we can help our users maintain context so they can focus without jarring interruptions. These means: use Ajax for each context, and each of those is its own single-page app.

Monolithic apps? NO: or at least, they aren’t nearly as useful as they are technically hard, and you should be very clear of the costs. You may get so much benefit, or have so many people working in the problems, that you can overcome the costs. Your *entire web app* does *not* need to be one single front-end app.

Page 103: Cutting the Fat by Tiffany Conroy

THANKS!

All content licensed under http://creativecommons.org/licenses/by-nc-sa/3.0/