
Optimistic UI with Meteor - djmashko2
http://info.meteor.com/blog/optimistic-ui-with-meteor-latency-compensation
======
dcre
Good post. It's worth pointing out this is diametrically opposed to the "Web
vs. native: let's concede defeat" piece that was popular yesterday.[1]

> When a user pushes a button in a website or a mobile app, they don't want to
> wait for a request to be sent all the way to the server to calculate the new
> state of the screen.

[1]
[https://news.ycombinator.com/item?id=9603845](https://news.ycombinator.com/item?id=9603845)

~~~
Brakenshire
I listened to an interesting podcast the other day about this topic:

[http://devchat.tv/js-jabber/114-jsj-asynchronous-ui-and-
non-...](http://devchat.tv/js-jabber/114-jsj-asynchronous-ui-and-non-blocking-
interactions-with-elliott-kember)

The guest was talking about the difficulty of putting yourself in the shoes of
someone far away from the global data-centres, when you live and work in
Silicon Valley / New York / London (he's from New Zealand).

He also said (which I thought was interesting) that Amazon preloads the first
items on the next search page, so the user doesn't have to wait for the
server, and then loads the rest in the background (with the idea that by the
time they have examined the first items, the others will have arrived).

------
nathan-muir
This post makes some great strides in explaining the core power of the meteor
framework;

Until now, I think Meteor wasn't on message for the experienced developer
market.

It's a mistake to sell a technical product with the pitch "Look at what you
can do with just a few lines of code!!!". And/ Or over simplified demos.

We want to see more articles like this- So now we know how it works - what are
the limitations? What are the problems scaling? etc.

~~~
bsbechtel
Could you expand on this? My perception has been the rejection of Meteor by
experienced programmers has been mostly fear driven and a lack of
understanding, but that has been my own opinion. I'm interested in
understanding better what is keeping experienced developers from adopting the
framework.

------
primigenus
Latency compensation/optimistic UIs is one of the first things that clued me
into why Meteor is so great back in 2012 when I watched the original
screencast:
[https://www.youtube.com/watch?v=fsi0aJ9yr2o](https://www.youtube.com/watch?v=fsi0aJ9yr2o)

The reason is actually a common theme throughout Meteor: boilerplate code, and
somewhat relatedly "devops" type code, are taken care of by the platform so
you get to focus on building your app.

It's such a big focus of Meteor's design compared to every other platform, and
it's what's kept me coming back for three years.

In fact, it's surprising that so few other platforms have picked up on the
fact that eradicating boilerplate is a feature, and they should compete on it.
Maybe with more posts like this, they'll be inspired to head in that
direction!

------
imslavko
More beginner-friendly articles about Latency Compensation are available on
the blog of Discover Meteor:
[https://www.discovermeteor.com/encyclopedia](https://www.discovermeteor.com/encyclopedia)
(the top section)

------
millstone
> Whenever the user takes an action, you need to first update your UI to make
> things look fast, then send a request to the server to do that modification
> on the real database.

Isn't this just lying to the user? What if the user acts on the update (e.g.
closes the page, satisfied the file has been saved) and thereby loses data?

~~~
akhatri_aus
On the other hand if something was shown to the user indicating changes were
pending, yet allowed other tasks to be done simultaneously and still have
everything come out in correct synchronous order, are people not better off
with the 'lie'?

~~~
millstone
What you describe is ideal and not a lie. Reporting progress ("Saving...")
while allowing concurrent edits is great! But it's dangerous to claim the file
has been saved before the save is complete, in the name of "make things look
fast."

~~~
akhatri_aus
I think the author should have mentioned that latency compensation with meteor
can be made optional.

This is in contrast to a large proportion of existing patterns where the
option to simultaneously pile on tasks and keep synchronicity is not
available.

------
vvanders
This is commonly called dead-reckoning in the games space and is used _all
over the place_ because perceived latency is such an issue with realtime
simulations.

Getting a good prediction and then knowing how to gracefully reconcile a
missed prediction is part art, part science and what makes building those
systems a ton of fun.

~~~
brandonbloom
While often related, dead reckoning in games refers to a particular technique
for latency compensation, not the general concept. Specifically, it refers to
calculating positions based on last known velocities.

[http://en.m.wikipedia.org/wiki/Dead_reckoning](http://en.m.wikipedia.org/wiki/Dead_reckoning)

------
SimionBaws
Just have patience and wait for HTTP/2

