I don't see this as particulairily bad code. I've seen similar thing be needed for testing asynchronous operations that need to account for some form of a delay. Or to check that a memoization function is correctly reducing the call time
That makes sense to me. It’s used for live-updating figures after recieving user input on a website though, so I am genuinely unsure if that applies. I’m very new to any kind of web/html design so I assumed it was just a little joke from the person who wrote the script.
Studies have shown if a website responds real fast users can be sceptical of it performing correctly. Sometimes injecting latency puts the users mind at ease. Especially for areas dealing with finance and other critical areas
But I feel the danger of making a critical service intentionally worse is worse than assuaging the fears of someone who doesn't understand what they're doing because 'its taking a while so it's probably working'
EDIT: after watching this video (which I had seen similar stuff before) I think that it still is a bad practice. The issue a loading screen solves is that it tells you when it starts checking and that it finished later. If you click a button and it appears that nothing happens, that is bad UI. Second, I think a better UI choice would be to give more detailed information about everything it checked, and let the user look at that, rather than waste the user's time looking at a loading screen. So instead of 'checking your financial records... 1... 2... 3...' you could have a popup that contains detailed information about what was checked or something.
A client had complained to me about this before. He kept mentioning that there isn't any loading indicators for the app, so his employees didn't know if app was working or not.
I checked over and over again for a couple hours with simulated delay and confirms that the indicator does work. I told him that it does work and that probably the API was just really fast so it didn't get a chance to show up before everything is already done loading.
He didn't care and demanded the indicator to be shown every time, I put on a 2 second delay for the indicator to animate a little and he was placated.
I spent so much effort in the caching and ways to optimise speed for the backend too, only for the client to request for essentially what is an artificial latency :(
Yeah, I've learned since then that "default" sane values by frameworks or whatever tools we use is good enough, and only change it it the clients want certain things done, no point wasting hours on something that clients probably don't care (and in this case, wanted to revert)
You’re right, I just hate that we have to make things slower for uninformed users. The time we waste having to implement these and wait for them to run is a lot longer than it’d take to go “Hey Karen, yes Yelp can actually suggest you a restaurant in 0.5s”
I don't know if there was a explicit paper published, I'll dig for it, but when I was at Facebook we ran a internal users study and found for certain pages like settings and payments users were happier when artificial latency was injected. I'll see if I can dig out an article or actual paper for you
Yep. That's why car searching and tax software's deduction searching is so slow. Because people would suspect it didn't search thoroughly enough if it didn't.
Even though google returns far more results which are far more complicated in 500 ms (and quite justifiably brags about it).
While I completely understand the reasons behind the artificial wait, this sadly also shapes the expectation of the user for the future (good "calculations" take their time) which again solidifies the need for artificial wait times. That way we will never get rid of those time waster ...
Maybe a delay like that should programmed to decrease in duration over the course of time, so that users can acclimate. Sorta like the frog in a slowly boiling pot of water
Many years ago, I was working as a web dev in an agency, and we had developed an eCommerce site for one of the most renowned brands in our country.
It was a bit of a nightmare project, as the client rep claimed some development skills – just enough to be dangerous.
One late afternoon, I got a report that the product list page using infinite scroll was super slow. For those who don't know this technique, the page is incrementally loaded when you scroll down. So instead of going to the next page, we just load in the next pages as the user scrolls and injects it on the page. Similar to what Facebook, Reddit and Twitter is doing.
I started investigating it, and found that it was some horrible code on the part of my senior colleague. I spent my evening working on it, and managed to get the load time of each page down from >2s to about 200ms.
Because it also takes a bit of time to scroll, it meant that for the user, there was no visible load time. The data was just there as you scrolled; it was a totally seamless experience.
I left the office that evening feeling quite proud of my solution, so I was a little surprised when the client called the next morning being absolutely furious.
According to them, I was cheating. They were convinced I didn't actually incrementally load anything, but loaded all products in at once.
My manager was also not very happy with me, and there was no way for me to convince them that I did in fact not cheat, my solution was just that awesome. It was even escalated to our CEO, it was ridiculous.
My solution was to just introduce a 600ms setTimeout around every page load. Everybody was happy as it was now clear that the page was being loaded incrementally, though my relationship with the client rep was soured forever.
honestly this is pretty good client side design. if the program just instantly snaps between screens, the user doesn't really feel like it's doing anything, but throwing in a huge lag spike really sells the illusion that something complex and important just happened
361
u/AsiagoCrackers Aug 07 '21
I don't see this as particulairily bad code. I've seen similar thing be needed for testing asynchronous operations that need to account for some form of a delay. Or to check that a memoization function is correctly reducing the call time
257
u/[deleted] Aug 07 '21
Sometimes its done to simulate what a user expects. If it's too fast, some people might think it didn't work.
103
u/inre_dan Aug 07 '21
I remember hearing that a lot of inexperienced people will question algorithms that are too fast and claim you didn't do it properly.
93
u/coolcalabaza Aug 07 '21
Not bad code. This is how things are designed sometimes.
35
u/y-am-i-ear Aug 07 '21
Idk. This is pretty solid unless if sleep is async. It might be a bit evil tho
23
u/GoldenKela Aug 07 '21
now you can tell you client to pay you more so your tech team can optimize it
<------------------>
bussiness 100
20
u/Nixargh Aug 08 '21
Many years ago, I was working as a web dev in an agency, and we had developed an eCommerce site for one of the most renowned brands in our country.
It was a bit of a nightmare project, as the client rep claimed some development skills – just enough to be dangerous.
One late afternoon, I got a report that the product list page using infinite scroll was super slow. For those who don't know this technique, the page is incrementally loaded when you scroll down. So instead of going to the next page, we just load in the next pages as the user scrolls and injects it on the page. Similar to what Facebook, Reddit and Twitter is doing.
I started investigating it, and found that it was some horrible code on the part of my senior colleague. I spent my evening working on it, and managed to get the load time of each page down from >2s to about 200ms.
Because it also takes a bit of time to scroll, it meant that for the user, there was no visible load time. The data was just there as you scrolled; it was a totally seamless experience.
I left the office that evening feeling quite proud of my solution, so I was a little surprised when the client called the next morning being absolutely furious.
According to them, I was cheating. They were convinced I didn't actually incrementally load anything, but loaded all products in at once.
My manager was also not very happy with me, and there was no way for me to convince them that I did in fact not cheat, my solution was just that awesome. It was even escalated to our CEO, it was ridiculous.
My solution was to just introduce a 600ms setTimeout around every page load. Everybody was happy as it was now clear that the page was being loaded incrementally, though my relationship with the client rep was soured forever.
32
u/alexanderhameowlton Aug 07 '21 edited Aug 07 '21
Image Transcription: Code
I'm a human volunteer content transcriber for Reddit and you could be too! If you'd like more information on what we do and why we do it, click here!
13
u/Cmgeodude Aug 08 '21
(I use time.sleep() all the time when doing testing automation. Sometimes the site just won't keep up with the testing program.)
(And sometimes just for the fun of it I do this:)
2
u/javaveryhot Aug 08 '21
Then you remove it and say you improved the speed of the service
2
u/KCGD_r Aug 08 '21
honestly this is pretty good client side design. if the program just instantly snaps between screens, the user doesn't really feel like it's doing anything, but throwing in a huge lag spike really sells the illusion that something complex and important just happened
TurboTax actually did this: https://www.theatlantic.com/technology/archive/2017/02/why-some-apps-use-fake-progress-bars/517233/
2
u/ssj4VB Aug 08 '21
I would recommend randomising that lol
1
u/SubtleCow Aug 08 '21
look sometimes that line is needed, we all wish it wasn't but wishes aren't fishes
1
u/Kyyken Aug 08 '21
tax calculators be like
1
u/GalaxP Aug 08 '21
I had a good laugh looking at this post
1
u/techek Aug 08 '21
This part of the design/user-interface should be moved to the front-end
1
u/[deleted] Aug 23 '21
ah yes
-9
u/bakahed Aug 07 '21
Op tries to farm karma at this point I guess. The quality of posts on this sub are shit