125
ultrono
8y

Me when viewing a line of PHP where the previous developer add "sleep(5)" to an Ajax endpoint with the comment "Sleep for 5 seconds so the ajax loading icon is visible to users".

FML.

Comments
  • 13
    I bet users or management where complaining that it wasn't showing and he just added that so people stopped annoying him 😂😂
  • 1
    @azous Maybe, but it's still a stupid idea. The actual endpoint performs a simple select on a single table and will never return more than ~10 rows.

    Granted, it's a nice loading icon, but still :)
  • 4
    That's not that unusual, on my current job I've had to do it already twice, due to final users' complaints for not seeing the flashy animation as expected.
    Blame the redundant highly scalabe architecture, I said to my boss...
  • 9
    Yup, optimized initial page load to under a second. Had to add 1,5 secs to show the fucking spinner more 👎
  • 5
    Actually there are cases where the interface is intentionally slowed down to provide a better feedback to the users. Facebook is one of those cases. There are studies that say that if for example an app makes an action instantly instead of pretending to do something on the background that takes time then the users tend to think that the app did nothing at all on the background (even though it did a lot) and lose trust.
  • 7
    Everyone knows you should add your fake delay on the front end so that enterprising redditors can write a user script to make it normal again.
  • 1
    Guilty. Not 5 sec though!
  • 0
    @jakallergis Interesting. Did not know about this nugget of info regarding AJAX and UX.
  • 5
    So when your boss ask you to improve the responding time you just have to reduce the delay time B)
  • 1
    And PHP gets blamed for shit like this, what a world we live in.
  • 0
    @Madeindjs good point :)
  • 2
    @Madeindjs i just realized what you said! This is genius!!!
Add Comment