News for hackers. Stuff that matters.
Re:Try quickly typing 1+ 2 + 3 into the iOS 11 Calculator by whalesalad on Tuesday October 24, 2017 @06:52AM (#15540654)
Your solutions are a little off the mark. Treating the animation as the problem is merely treating the symptoms.

What needs to happen here is pressing the button needs to immediately register the press elsewhere in the code. The UI animations and the button tap should be decoupled entirely.

Then the user can tap away as fast as their heart desires and only the animations are going to continue on. That’s an easy problem to solve... by doing as you say and aborting them or shortening them.

But you should NEVER have UI animations and effects block your logic path. They should be parallel operations not serial.

Re:Try quickly typing 1+ 2 + 3 into the iOS 11 Calculator by mannykannot on Tuesday October 24, 2017 @08:22AM (#15541013)
Exactly. This is a very general pattern of error in software design - the use of a non-causal pathway to model causality. It is an especially exasperating problem, as it is both more complicated and more prone to failure than doing it right.

This goes well beyond UI design, and there are even physical analogs - for example, the crash of Turkish Airlines flight 981 in Paris could have been prevented if the device to prevent the cabin being pressurized if the cargo door was not properly closed had been operated by the door locking pins sliding home all the way, rather than by a side-linkage off the linkage that was supposed to drive in the pins.

https://en.wikipedia.org/wiki/Turkish_Airlines_Flight_981#Ca...

Re:Try quickly typing 1+ 2 + 3 into the iOS 11 Calculator by kemayo on Tuesday October 24, 2017 @10:24AM (#15541740)
My "lazy" solution was absolutely treating the symptoms, yes. Which is why I classified it as a lazy one, even.

But I feel my first suggestion was exactly what you're suggesting -- immediately register the input and apply the operator -- I just phrased it in terms of what happens to the animation.

Also! I certainly feel there are times when letting an animation block your logic is valid. That would be any time when an animation has the UI in a potentially confusing state, such that the meaning of an input is ambiguous. (You should avoid these states as much as possible, of course. And this sort of button-flash comes nowhere even near that category.)

Re:Try quickly typing 1+ 2 + 3 into the iOS 11 Calculator by stult on Tuesday October 24, 2017 @09:34AM (#15541382)
Isn't 'never' an oversimplification? Sometimes there is a feedback loop between UI effects and user input, or the user input changes the way the UI registers hits, which means subsequent input depends on complete processing of prior inputs. On a static view like a calculator grid, you should default to non blocking animation, but sometimes blocking is the desired behavior.
Re:Try quickly typing 1+ 2 + 3 into the iOS 11 Calculator by infinisil on Tuesday October 24, 2017 @09:40AM (#15541407)
What's a concrete example of this?
Re:Try quickly typing 1+ 2 + 3 into the iOS 11 Calculator by jamesrom on Tuesday October 24, 2017 @09:59AM (#15541532)
An example that comes to mind is a slider switch (iOS is famous for them)

You don’t want the switch activated until it’s all the way left or right.

Re:Try quickly typing 1+ 2 + 3 into the iOS 11 Calculator by stult on Tuesday October 24, 2017 @10:01AM (#15541553)
An even simpler example is page-based navigation. Can't register UI hits while pages are animating in and out.
Re:Try quickly typing 1+ 2 + 3 into the iOS 11 Calculator by dajt on Sunday November 05, 2017 @06:18PM (#15632380)
What if you want to quickly flick through pages? Having to wait for each page to render would be awful.
Re:Try quickly typing 1+ 2 + 3 into the iOS 11 Calculator by mannykannot on Tuesday October 24, 2017 @10:35AM (#15541830)
Slider controls might be a better example, I think. In that case, the position reached by the moveable element is the data, and it is appropriate to take the value from the UI element (of course, if it lags noticeably, that is a UI design issue.) With slider switches, you could argue it either way, so long as program and UI remain consistent, but again there is a problem if the UI response lags the gesture.
Re:Try quickly typing 1+ 2 + 3 into the iOS 11 Calculator by maccard on Tuesday October 24, 2017 @10:18AM (#15541702)
Video games use animations as easy to project information to a player. If your character is “stunned” and can’t move, the animation should play for the duration of the status effect.
Re:Try quickly typing 1+ 2 + 3 into the iOS 11 Calculator by whalesalad on Tuesday October 24, 2017 @10:50AM (#15541960)
Sure. But that’s an inherent feature of the animation. In this case the “never” rule doesn’t apply. If animations are a side effect, you want to treat them as such.
Re:Try quickly typing 1+ 2 + 3 into the iOS 11 Calculator by maccard on Tuesday October 24, 2017 @03:47PM (#15544633)
The never rule not applying what what I was giving an example of!
Re:Try quickly typing 1+ 2 + 3 into the iOS 11 Calculator by damnyou on Tuesday October 24, 2017 @11:58AM (#15542557)
But should any buttons pressed during that time be queued? Command queueing and cancellation is an important part of game design.
Re:Try quickly typing 1+ 2 + 3 into the iOS 11 Calculator by Invisig0th on Tuesday October 24, 2017 @09:54AM (#15541497)
Tetris
Re:Try quickly typing 1+ 2 + 3 into the iOS 11 Calculator by mcny on Tuesday October 24, 2017 @07:02AM (#15540691)
My professor likes to tell this story about keyboard buffers that I never quite understood. Basically, in this old time terminal setup he would start typing the password before the prompt showed up or something and when it did, it would just sail through. Sort of like how I can apt upgrade while apt update is still running but fancier and a couple of decades before...
Re:Try quickly typing 1+ 2 + 3 into the iOS 11 Calculator by colejohnson66 on Tuesday October 24, 2017 @08:13AM (#15540969)
The computers at my old job working as a cashier did that. It made working with produce so much faster because as soon as I heard the beep, I could move on to the next item, even if the screen hasn’t updated yet.
Re:Try quickly typing 1+ 2 + 3 into the iOS 11 Calculator by vanderZwan on Tuesday October 24, 2017 @07:31AM (#15540806)
That "old time" hurts a bit.. I haven't tried this recently, but I distinctly remember doing this in the early versions of Ubuntu.
Re:Try quickly typing 1+ 2 + 3 into the iOS 11 Calculator by whatever_dude on Tuesday October 24, 2017 @08:34AM (#15541077)
That's what happens when you read from a keyboard buffer. Since the buffer is not being read (and not cleared) until a prompt is in the screen, you can type whether you want and it'll get dumped and processed whenever needed. Not that long ago really, that's how it worked in DOS and most other terminals.
Re:Try quickly typing 1+ 2 + 3 into the iOS 11 Calculator by kijin on Tuesday October 24, 2017 @09:58AM (#15541524)
It still works. I can ssh into a machine and start typing commands before the shell prompt appears. The commands will appear in the terminal once the connection is established and the shell is ready.
Re:Try quickly typing 1+ 2 + 3 into the iOS 11 Calculator by chasd00 on Tuesday October 24, 2017 @12:51PM (#15543011)
Isn't the keyboard buffer a part of the physical keyboard circuitry and interface? Hitting enter triggers an IRQ to flush the buffer, so if the CPU is too busy to handle the IRQ then things queue up until the CPU can get around to handling it. If that's the case, for this "feature" not to work would require a very low level architectural change to keyboards. (it's been many years since i've thought about this though)
Re:Try quickly typing 1+ 2 + 3 into the iOS 11 Calculator by singingboyo on Tuesday October 24, 2017 @03:27PM (#15544483)
Keyboard buffers are decidedly not on the physical keyboard. The keyboard might have a very small one, but the IRQ is triggered on every input.

The buffer in question is, for a tty, a driver-level buffer that holds on to the data until something reads it. If a command doesn't read it (which things like apt-get update don't) then it'll get read as the next command.

Of course, most terminals these days are ptys accessed via emulators, so the buffer is actually part of the emulator, but the same idea applies.

Re:Try quickly typing 1+ 2 + 3 into the iOS 11 Calculator by chasd00 on Tuesday October 24, 2017 @03:42PM (#15544591)
ah, the more you know :) I would have been shocked if i remembered all that correctly
Re:Try quickly typing 1+ 2 + 3 into the iOS 11 Calculator by exikyut on Wednesday October 25, 2017 @09:25AM (#15549869)
For some reason my brain still finds it important to remember that the BIOS keyboard buffer is 15 bytes by default, but that you could load tiny little devices drivers in CONFIG.SYS in MS-DOS to make it a whole 31 bytes.
Re:Try quickly typing 1+ 2 + 3 into the iOS 11 Calculator by jdmichal on Tuesday October 24, 2017 @07:15AM (#15540742)
You can still do this in at least some shells. PowerShell buffers input if the running program doesn't capture it. If I have a build and execute commands in the history, I can hit up-up-enter twice in a row to start the build and queue the execution command.
Re:Try quickly typing 1+ 2 + 3 into the iOS 11 Calculator by dep_b on Tuesday October 24, 2017 @07:30AM (#15540802)
I remember people doing that on an AS/400 ramming keystrokes for 5 seconds and then waiting 15 seconds for the system to arrive in the right screen, sometimes even already filling the fields from muscle memory. The first five lines of address data were already entered before the screen loaded.
Re:Try quickly typing 1+ 2 + 3 into the iOS 11 Calculator by coleca on Tuesday October 24, 2017 @05:03PM (#15545234)
When I was in high school I had a job after school where they still had a PDP/11 w/real DEC VT-100 terminals. The kid next to me used to do data entry and would get far ahead of the input screen. Except when he made a mistake, and he often did, it would beep. But because he was so far ahead when he made a mistake it would beep for 2 minutes straight. Every time. Max-volume.

Soo.. When he left his desk, I went in and hit SHIFT-SETUP, turned the audible BEL off in the VT-100 setup menu and enjoyed the silence.

When I came back in the office the next day, there was a technician from Digital with the terminal in what looked like 100 pieces on the desk trying to "fix" it. He was pretty upset when he realized it wasn't the speaker and the setting was just turned off (why he didn't check that first, I'll never know). Needless to say as a teenager, I kept quiet about the whole thing.. until now..

Re:Try quickly typing 1+ 2 + 3 into the iOS 11 Calculator by exikyut on Wednesday October 25, 2017 @09:24AM (#15549857)
Oh wow. That is awesome.
Re:Try quickly typing 1+ 2 + 3 into the iOS 11 Calculator by darylfritz on Thursday October 26, 2017 @01:56PM (#15561355)
> Sort of like how I can apt upgrade while apt update is still running but fancier

You can link two commands together with the "AND IF" operator

    sudo apt update && sudo apt upgrade
Furthermore, you also have `||` which is the logical or, and also `;` which is just a separator which doesn't care what happend to the command before.
Re:Try quickly typing 1+ 2 + 3 into the iOS 11 Calculator by jasonkostempski on Tuesday October 24, 2017 @09:30AM (#15541353)
I see that buffer effect all the time still.
Re:Try quickly typing 1+ 2 + 3 into the iOS 11 Calculator by auggierose on Tuesday October 24, 2017 @08:27AM (#15541033)
It is not as easy as that. UI and logic should run in parallel , yes, but they should also be able to synchronise.