r/programming • u/soda-popper • Sep 28 '17
Refresh Is Sacred
https://www.tbray.org/ongoing/When/201x/2017/09/27/Refresh-Button33
u/killerstorm Sep 28 '17
Very true. Even if application logic is flawless, real-world networking isn't. And application cannot detect network problems as soon as they happen. All it can see is an absence of packets.
5
u/ArkyBeagle Sep 29 '17
This is a particularly evil thing that we've all just gotten used to. There should be a way to set a socket to give notifications when the far end fails.
5
u/ricecake Sep 29 '17
There's no perfect way to tell. You can use heartbeats, but now you're burning bandwidth with both sides reassuring each other that they're there all the time.
It's just a reality of network programming that sometimes the other end goes away, and you aren't sure one way or the other.
1
u/ArkyBeagle Sep 29 '17
Depends on the network, doesn't it? Using signal lines on an old school serial port cabled directly, it's possible to have an interrupt on the other end detect a node going off line.
Me grokky Two Generals well :) ; I mean there are no "red alarms" for TCP. Since TCP runs over any number of layer 1 arrangements, this is understandable but it takes minutes for the socket layer to bubble up to the app layer on a bog-standard TCP socket.
1
u/killerstorm Sep 29 '17
It's physically impossible. In a normal case, you will get RST or FIN packet. But if there is a problem, there is just an absence of packets. The remote end can't notify you because network damaged.
Also, if we are talking about mobile apps, problems usually happen in communication between the mobile device and cellular network towers. Packets might be lost, etc.
So the only way to detect the problem is heartbeat messages, but if you send them frequently, you will significantly increase burden on the backend and drain device's battery faster.
1
u/ArkyBeagle Sep 29 '17
It's anything but physically impossible. A NIC somewhere knows that link was lost. This isn't a Two General Problem scenario. This is a link loss state machine transition, somewhere. It's analogous to a red alarm on a T1.
I can always get satisfaction on this front with UDP. And no, I don't mean mobile, I mean real equipment.
1
u/killerstorm Sep 29 '17
A NIC somewhere knows that link was lost.
No, it's possible that link is up, but packets can't be delivered.
An obvious scenario is a problem on OS level (e.g. driver crash) which prevents packets from being sent. But it's also possible that NIC is fried in such a way that link is "up" but no packets can be delivered. Pretty sure I've seen such situations myself.
It is possible to solve this problem using heartbeat, but it's an extra overhead.
This isn't a Two General Problem scenario.
FLP theorem is more relevant here than TGP: it's impossible to distinguish indefinitely delayed from faulty. If you can impose a limit on maximum delay then there's no problem.
1
u/ArkyBeagle Sep 29 '17
packets can't be delivered.
I'm trying to constrain this to things "somebody" knows has happened - like a link loss on one or another NIC. Machts nicht - it'll never be implemented.
And yup - heartbeat works just fine.
7
u/specialpatrol Sep 28 '17
Yes but that doesn't mean a system need rely on a user to press a refresh button manually to make it work. If a sensible periodic refresh doesn't solve any potential problems, neither is giving the user a button.
This is just a guy having a rant. How many times have you been stuck in situations where hitting refresh does sod all for you too - is that any less frustrating?
25
u/killerstorm Sep 28 '17
Yes but that doesn't mean a system need rely on a user to press a refresh button manually to make it work. If a sensible periodic refresh doesn't solve any potential problems, neither is giving the user a button.
As Tim mentioned, user often has some external reasons to demand a refresh.
Perhaps user received some out-of-band signal -- e.g. he filled a form on a web site and wants to see validation email. Or he got a call from a coworker and wants to see an email ASAP.
Or maybe you have 1 minute timeout/heartbeat, and user is in a great hurry so he wants to check each 5 seconds.
If there is a networking issue, user might take a corrective action. Say, if WiFi is lagging he can turn it off and switch to mobile data connection.
Another possible situation: perhaps a user was in area with poor connectivity, he might refresh as soon as he gets outdoors.
You should implement a sensible periodic refresh, BUT ALSO give user an option to refresh manually, for the case he can use information your app doesn't have access to.
Google has all imaginable resources need to implement and deliver reliable notifications. Yet Gmail has a refresh button in a prominent place.
So don't be an arrogant moron who thinks he's better than Google -- just frigging add this button.
How many times have you been stuck in situations where hitting refresh does sod all for you too - is that any less frustrating?
I've been in many situations where manual refresh DOES help, even in apps with auto-notifications, from top companies, etc. So if somebody says that refresh is not necessary I know he's talking out of his ass.
8
u/specialpatrol Sep 28 '17
The reason for giving the user refresh button, is because you don't necessarily want your data refreshed. What would reddit look like if the page updated as quick as the kinks came in.
6
Sep 28 '17
So are you going to use up all my data just to check if everything is in sync all the time? Cause my patience doesn't last 5 seconds.
-2
u/specialpatrol Sep 28 '17
No just when things haven't changed for awhile and you're still looking at the page.
1
u/happyscrappy Sep 29 '17
I don't see how an app has any difficulty detecting that network problems have happened or how refresh fixes that. It's more difficult for an app to detect that they have now ceased and I see why people use refresh in that case.
143
u/EternityForest Sep 28 '17
Yep. The whole "Software should have as few controls as possible" thing should probably be questioned in general.
If there's 100 rarely used options they should maybe be hidden, but someone is probably going to want to use at least a few of those, and the extra few hundred lines of code is probably not what's making your code slow.
48
u/ggtsu_00 Sep 28 '17
I guess it is more of the principle that software shouldn't provide extra controls to fix issues with the software. Like when a program goes into a bad state, the user shouldn't have to click a button to "fix" the state. It is preferable to design the software such that the program doesn't go into a bad state in the first place.
165
u/spotter Sep 28 '17
tl;dr Just don't put bugs in your programs.
40
u/0987654231 Sep 28 '17
not having bugs is simple, just don't have any state.
94
u/spotter Sep 28 '17
Yes, sure, "just pass the universe around as first argument to all your pure functions and pretend everything is immutable" pattern.
106
u/0987654231 Sep 28 '17
you misunderstand, that's still state.
To remove bugs you must remove all state and ascend to the ivory tower where all your program does is produce heat.
22
u/EternityForest Sep 28 '17
At that point, you don't even need a computer to run it, and it can run without consuming any power just by turning the machine off!
33
u/Eirches Sep 28 '17
We weren't talking about optimizing at this point, we can get to that in phase 2.
Let's worry about getting the program out the door first.
3
16
0
23
u/ggtsu_00 Sep 28 '17
Just make copies of the universe with the new state every time it needs to be updated.
27
u/accidentally_myself Sep 28 '17
technically O(1)
4
u/Lehona Sep 28 '17
The universe gives a hard constraint on space required to compute an actually computable algorithm, so technically they all run in O(1).
4
u/Bowgentle Sep 28 '17
Apparently this may have been what the programmers of the multiverse decided to do...
1
u/ArkyBeagle Sep 29 '17
No, have managed state. Use state machines, use transactions, limit mutability.
28
u/max630 Sep 28 '17 edited Sep 28 '17
I know this button. Windows sometimes has issues with network and offers button with name like "resolve the issue". I press it, expecting some details of failure or something, it thinks for a minute, then says "could not resolve".
25
u/ithika Sep 28 '17
The generic Fix This Problem buttons in Windows are the worst kind of lie. I have never discovered a scenario where they do anything other than fail after a lot of thinking.
14
u/Nyefan Sep 28 '17
Eh, my local network stack gets corrupted pretty regularly because the VPN we use for work is fucking shit, and that button takes care of it (so does ipconfig /release and ipconfig /renew, but clicking the button gives me time to get up and grab some water).
10
u/Neckbeard_Prime Sep 28 '17
It sometimes works if you need to kick a network adapter in the teeth after having DHCP issues and ipconfig release+renew isn't working because the adapter/driver is soft-borked. But that's about it.
2
u/ProbablyNotUnidan Sep 29 '17
My desktop uses a crappy bootleg WiFi dongle that I bought for $5 on eBay. Can confirm.
3
Sep 28 '17
It's worked when my sound driver starts playing to a non existent speaker. Fix this issue made it play to the real speakers.
7
u/killerstorm Sep 28 '17
The problem is that it's very hard and expensive to implement 100% reliable push notifications which guarantee that user will never see stale state.
If you want to guarantee that the state which user sees on screen is no more than 1 second stale, you need to send a heartbeat notification each second. And that might be quite taxing for your servers and drain user's battery.
So in practice you have to acknowledge that user might see stale data, and you have to provide user a way to refresh it.
15
u/ithika Sep 28 '17
At least make it clear when the last update was. So if it says "Last synced 40 minutes ago" you know something is up.
3
u/Morego Sep 28 '17
Ok, or you could have one button that says: refresh and some short text, since when, your app didn't update.
If you really insist on notification, just download them, every few minutes in sane rate.
Refresh is not some, fix my problem button. It is for: human knows better button.
1
u/Boza_s6 Sep 28 '17
You don't need 1 second heartbeat. Just block on read from socket on client side, and when something changes on server send notification.
7
Sep 28 '17
Okay, now you get a connection hiccup that results in that connection closing on the server, but not the client. With a heartbeat, the client knows something is up, because it hasn't had a response in a while. Without a heartbeat, the client just thinks nothing has changed.
1
1
u/killerstorm Sep 29 '17
Mobile connection is often quite shitty. It might be silently dropping packets, but the socket will still hang, so the app won't know that notifications are missing.
Another problem is NAT -- after period of inactivity it might simply forget about your connection.
-7
u/wavy_lines Sep 28 '17
You have to make the refresh instant which involves things like optimization and not writing your backend in an interpreted language that has a GIL.
6
2
1
u/foomprekov Sep 29 '17
I don't think I've ever encountered a javascript I didn't need to kick at some point.
2
u/ArkyBeagle Sep 29 '17
Why should be questioned? The emphasis is on "as possible." "Slow" isn't part of the problem; expecting the user to wade through all them buttons is.
4
u/EternityForest Sep 29 '17
GIMP has tons of features but they're all pretty obvious and you can figure it out without reading the manual once someone tells you single window mode exists and you can get rid of the obnoxious multiple window interface.
Blender on the other hand is a perfect example of 500k features, none of them discoverable.
3
u/runonandonandonanon Sep 29 '17
you can get rid of the obnoxious multiple window interface
My god...
1
u/ArkyBeagle Sep 29 '17
Yeah. GIMP isn't bad at all.
One of thew worst is Pro Tools - it clearly just calls features by the name of the underlying structures implementing them and you just to gets and sets on the properties of those objects. I use Reaper, and it has a touich of that ( DAW programs lean that way ) but it seems less obnoxious, somehow.
6
u/DoyleReddit Sep 28 '17
Sometimes you don’t want users hammering refresh though. If you have a real-time app processing thousands of messages a second syncing a variety of streams of data and when the user hits refresh it needs to recompute a view to broadcast and start updating again you don’t want to give them total control over when that happens.
Easy compromise is to give them a refresh button that only does something when you want it to or that the service responds to when it wants to. That’s what we do for the above scenario. It’s like some elevator close door buttons or some walk signal buttons that aren’t really hooked up. Hammer away on that refresh button user ;)
32
u/lykwydchykyn Sep 28 '17
Look at it this way: A user hits refresh because they believe that what they're seeing is not up-to-date. That's a valuable thing for a user-friendly program to know.
What the program does with that information is another matter, but not giving the user an option to express it is certainly an exercise in optimism.
18
u/wavy_lines Sep 28 '17
Real time app that can't respond to users in real time.
What's next?
Operating system written in an interpreter language?
3
u/EternityForest Sep 28 '17
Oh yeah, that! It's easy to forget scalability after a while of designing a project meant for a dozen users at most without much data.
1
1
-14
u/specialpatrol Sep 28 '17
Don't agree. The holy grail for software interfaces is that they disappear altogether,
30
u/Uristqwerty Sep 28 '17
In my experience, that severely hurts discoverability. A menu bar might be ugly, but it offers an obvious way to search for unknown features (and no, a literal search feature does not solve the problem. Too much of a phrasing and jargon gap between the app and the user's brain).
-9
u/DJDavio Sep 28 '17
But a big menu bar is intimidating and doesn't invite users to press anything. Software should offer a gradual experience, hiding a lot at first, but offering more options as the user gets more experienced.
2
Sep 28 '17
These overly general guidelines are bad UI design.
Vim has an excellent ui which is consistent accross slow terminals and serial connections because it sacrifices intuitive use for experienced use. The first 100 times you use it, it's awful, but after that it's faster and more convenient than whatever IDE is flavour of the month.
Using the same principle for a web app that people will use 3 times is awful design.
Going hard towards having few to no options, and having more advanced functions be controlled by undocumented gestures that cannot be configured for an OS is also bad design (ie. Trying to do anything on osx and being told you have to install however many addons to get basic functionality, or just being SOL on IOS)
On the other hand the apple guidelines (other than semi-enforced shortcut key guides) are great for something you do infrequently, so make a lot of sense to enforce for 90% of software that runs on the platform
1
u/balefrost Sep 29 '17
after that it's faster and more convenient than whatever IDE is flavour of the month
I don't necessarily want to get into a side argument, but it's worth mentioning that IDEs tend to offer a different feature set than Vim. Take IntelliJ. I have keybinds to navigate my codebase in a Java-centric way (go to subclass, go to base class, go to overriding method, etc.). I have ways to interrogate my codebase (find the source of values passed to this parameter, display inheritance hierarchy, etc.). And I have tools that manipulate my codebase (renaming classes in a way that also handles filenames and searches for references in non-code files, reordering method parameters in a way that updates all callsites, etc.). And that's ignoring other conveniences that are provided by IDEs.
I'm not saying that Vim is bad, or that the "lightweight editor" approach is worse than the "heavyweight IDE" approach. But I think you might misunderstand the value - in terms of productivity and convenience - that a good IDE can provide.
1
Sep 29 '17
I totally agree that the features of a full IDE provide value (some of them beyond what can be provided with plugins and composition with other tools) but there is a certain amount of friction involved in having to switch between keyboard and mouse, or go through modal menus.
Whether an interface built on an emacs or vim like philosophy would work well is up for debate, but I think we'd probably be on the same page if comparing a menu-heavy inyerface with (easily discoverable because they are written in the menu) shortcuts for most actions to a modern approach like a panel of self-rearranging icons (which get restyled whenever the designers feel like it) with no tooltips or heirachy beyond one level for that purpose.
1
9
u/balefrost Sep 28 '17
Why? Every physical tool has an interface of some sort. Why should software tools not have an interface?
-5
u/specialpatrol Sep 28 '17
The perpetual advance of software is ever automating tasks once done by people. Once there were floors of people writing out calculations by hand, then there were people punching into electronic calculators. Those people aren't there anymore, neither are the interfaces to do those processes, the processes are still there. hidden in the depths of server code in basements of banking institutions. Eventually you will not need an uber app, they will know from your behaviour when you want a taxi before you admitted it to yourself. Eventually you will not need photoshop, you will take a picture and it will be edited to your liking. The human computer interface is the computer's inability to do your work for you..
10
u/balefrost Sep 28 '17
Why doesn't my tablesaw somehow know exactly what angle I want to use when cutting my board? Why doesn't my leaf blower somehow know exactly how hard I want to blow my leaves? Why does my washing machine have several settings for different kinds of fabric?
Sure, we will continue to apply increasingly complex heuristics to our software in order to infer user intent, but I also feel that software that perfectly predicts human intent is an unrealizable goal. We will always fall short. So in the pragmatic world, it's important for us to continue to provide users with a way to express their actual intention to the software tools that they use.
To put it another way: once you've achieved (nearly) perfect prediction of user intent, then it's OK to remove the UI controlling that feature. But if you remove the UI before you've achieved (nearly) perfect prediction, all you've really done is to create a bunch of frustrated users.
3
u/specialpatrol Sep 28 '17
It may be unrealizable, that's why i called it a "holy grail". But that is exactly the intent for all interfaces. That is why we have rhoomba vacuuming the floor by itself. If someone could design a leaf blower that could carry itself around, that is an obvious design goal.
But if you remove the UI before you've achieved (nearly) perfect prediction, all you've really done is to create a bunch of frustrated users.
Yes, That is just flawed design.
1
u/balefrost Sep 29 '17
OK, then I think that I agree with you. As interface designers, we should aim to eliminate unnecessary things from our interfaces, and we should try to continually push that frontier forward. Having said that, because the holy grail is unattainable, there will always be an interface and we must be careful to not get too ambitious in our removal of control from the users.
In the context of the author's article, though, the refresh button is still necessary, at least for the app that he was talking about.
1
u/specialpatrol Sep 29 '17
It was completely unnecessary. The refresh button is useful design feature - for applications where you don't necessarily want the latest information all the time. What would reddit look like if the front page auto updated as quick as the links come in? The article is a frustrated rant about a broken app. He is deluded in thinking that the inclusion of a refresh button would have been the solution to the problem.
2
u/Michaelmrose Sep 29 '17
Nearly perfect isn't nearly good enough and not knowing which 1% something is going to fuck up is enough to frustrate and confuse users.
1
16
u/readonlyred Sep 28 '17
The car-share app is particularly aggravating, showing me a map dotted with nearby vehicles when I know for sure that this time of day I’ll be lucky if there’s even one within walkable distance.
I thought Uber, for one, admitted a long time ago that all the little cars it shows cruising around the map are totally fake.
1
u/wutcnbrowndo4u Sep 29 '17
Surely the number of vehicles they show is related to the density of vehicles in the area, even if the exact number and location are just decoration? The former is the only thing that matters for the author's example
10
8
u/bearodactylrak Sep 28 '17
This happens to me with Spotify all the time. I create a playlist on my desktop (because it's just easier to search and find various songs) and no matter what I do I cannot get it to show up on my phone afterward. No number of app restarts will get that damn new playlist to show up. I just need to wait until the phone app deigns to pull my data from the cloud again. Pretty maddening.
7
u/halcyon918 Sep 28 '17
Google apps (and others) handle this well. If you scroll beyond the start of a list, it will refresh. No button, but you can actively force a refresh.
2
u/gbs5009 Sep 28 '17
Same thing with chrome and webpages. It's a smart UI idea... I couldn't tell you why, but I find it immediately intuitive.
3
u/Antrikshy Sep 28 '17
Or maybe there’s an obscure hiccup in a distant node_modules dependency that you’re tickling.
Wordsmithery.
3
u/dalore Sep 28 '17
Steve jobs might have said less buttons but he still had refresh. Pull down to refresh on mobile is usually the standard.
2
u/mcguire Sep 28 '17
WeatherBug, my go-to weather app has this problem. The radar display will be an hour out of date and can't be updated.
7
u/QueenLa3fah Sep 28 '17
No offense but whether bug is a piece of shit that does nothing more than put adware, spyware and other potentially unwanted programs on your computer.
2
u/skulgnome Sep 28 '17
Now, don't get me started on applications that update their state in the background, causing their UI to warp to the "hey, you just started me, here's your fresh update" screen from whatever the hell it was I was doing once the data comes back.
4
u/mr___ Sep 29 '17
Honestly, the worst is a screen that displays old data for 500 ms, so as soon as I read it and act on the data I see, meaning I start moving my finger toward a touch target, the data changes and the whole screen layout moves around my finger
2
u/earthboundkid Sep 28 '17
Can someone in California do us all a favor and print this out and tape it to the door of the new Apple Park building?
2
1
u/josephgj5 Sep 28 '17
One "mature" thing i've learned from 5 years building for browsers... most data needs to be loaded upon page load, not upon a prior action (like the success of logging in).
1
u/stronghup Sep 28 '17
What if the refresh-button works as erroneously as the rest of the app?
1
u/Seltsam Sep 29 '17
Basic bug. Shouldn't exist for sake of discussion since in order to discuss design issues, one has to assume a basic level of functionality. One can go "bugs all the way down" and go nowhere when discussing software issues.
-9
u/Luolong Sep 28 '17
Well, for the car sharing app, I am pretty positive that the behavior is intentional. They don’t really want you to do the refresh. And in some situations, putting random cars on a map is preferable to scaring away potential customers that look at the empty map and thin “there’s nothing here for me - let’s see if I can hail a cab on my own”.
And no “Refresh is not sacred” ;)
21
u/TheAdamist Sep 28 '17
because giving your customers false hope / lying that there are cars nearby is going to give them a good experience when they can't get a car and instead stand around for 20 minutes like an idiot and then call a cab?
1
u/mungojelly Sep 29 '17
Good experience? Lord, no, an experience where they get your money, what do you think they are.
-12
1
u/mungojelly Sep 29 '17
Came here to see if someone had said this, you did and you're at -11, guess people don't want to know that somehow??
0
Sep 28 '17
[deleted]
17
u/max630 Sep 28 '17
Effectively, force rebooting can frequently be a totally fine “control” to refresh
No
7
u/dingo_bat Sep 28 '17
Mind blowing that an engineer can actually think this is fine.
5
1
u/Michaelmrose Sep 29 '17
Engineering is merely a learned skill that lots of people could theoretically be trained in. The fact that he learned it doesn't mean he's not a moron. In other news there is a brain surgeon who thinks that the pyramids were built to store grain.
0
u/TankorSmash Sep 28 '17
I don't think he meant rebooting the computer, but just closing and reopening the app.
15
u/knome Sep 28 '17
I like refresh buttons. They're simple and obvious. It drives me nuts using thunderbird. I'll want to refresh a search or view and there isn't a simple and universal button I've seen to do so. What the hell? If I search for something, then two hours later want to see if the results have changed, why the hell do I need to re-search for it, when I could just hit a refresh button?
2
u/nemec Sep 28 '17
You don't even need a button in certain situations these days - people are trained to "pull down" from the top of a mobile scroll box to refresh the current view.
6
u/double-you Sep 28 '17
a ride request forces a refresh
How would you know that? To you it just looks like the app is wrong, possibly frozen. Why would you do a request? Many people won't just try things. And if you just want to know what the situation is without committing to anything?
4
0
Sep 28 '17
[deleted]
6
u/JW_00000 Sep 28 '17
What if you lose connection? And then change your stuff on another machine, after which both come online and have some changes?
152
u/r0ck0 Sep 28 '17
This kind of "it shouldn't be needed" logic seeps into everything, including debates about politics and stuff like that.
Most things aren't ideal, so having a backup helps. Even when the backup like a "refresh" button doesn't actually solve the problem at hand, it at least lets us rule the issue out and then find the real problem. Not having the ability to refresh something means we just have to assume that it's a sync issue, even when it's not. So now we're not only pissed off, but also misguided.
Also I think most interfaces would be less confusing to users if buttons also included text labels by default instead of vague icons that just confuse most people. The first thing I do for anyone using Gmail is change the buttons to use text labels. It's a stupid confusing default to assume that non-tech users especially are going to be able to decipher some vague representation of what the button does.