Thursday, June 1, 2017

The Progress UI Anti-Pattern

Lots of software these days displays progress indicators: spinning hourglasses, bouncing balls, whirling windmills, or cataclysm countdowns. It is well-known in the UI world that animated progress bars improve perceived user experience. Holding the software constant, if nothing is displayed during an ongoing task, the user will lose interest in it and begin to wonder if the computer is frozen. Whereas, if a spinner is displayed, the user will stay within the interface and not complain about it. Finally, when the progress bar has pulsating ribbing moving backwards, time appears to move faster.

What is less well-known is the mechanism for this. As usual in neuroscience there is still no conclusive theory of the perception of time, but instead some competing theories and interesting experiments. In this study they suggest that their rats use head behavior as timing; basically, the rats started a dance, and compared the ending of the stimulus with where they were in the dance. In this paper we see that training can create reasonably accurate neural signals corresponding to interval timing tasks, but that the mechanism for these is still unknown. Finally in this paper we observe multiple timing mechanisms in use in humans; widespread counting mechanisms, a comparison system in "the temporal semantic system", and a switch in collation mechanisms between the default-mode network and the the motor network around 2 seconds. The motor network is active for durations in the hundreds of milliseconds, firing at 30-40 Hz, while the default-mode network is active for longer durations (above 2 seconds), firing at 10 Hz.

So, we can confirm the 1-second flow rule; after 1 second (closer to 1.5 according to experiment), the default-mode network gets activated and the user loses engagement with the task.

But the 10 second rule is pretty arbitrary, and the decision to use progress as the indicator even more so. Following Edward Tuft's simple proviso of "maximize the data-ink", we can create guidelines. For an indeterminate progress indicator, only the state is actual data, and the rest of the animation can be removed. A simple state indicator such as color suffices. I have been testing this myself for the past few years using my Static Throbber theme in Firefox. I can report that I now hate seeing the animated throbbers on other browsers; they just look tacky.

So, this works for short indicators, less than ten seconds. But, sometimes we have longer things. For example, while I was writing the last sentence, Firefox froze for 20 seconds, because of some JavaScript in a background tab. Well... that still doesn't count. The window manager can give Firefox in a "non-responding" window decoration, and since progress is indeterminate that's really all that can be done. (And for the case that the window manager freezes... that's why I have it displaying a clock with second-level precision, so as to see if it's still progressing. If the clock stops ticking, it's time for a reboot). Alright. So 20 seconds is too short to start thinking about estimating progress; how long do we have to go? I would guess the 5-minute range; after that, it's long enough to start thinking about switching tasks and doing smallish routines such as preparing meals.

For estimated times, the only useful data is the time to completion, e.g. 24 minutes. But this changes frequently; a better idea for long-style progress indicators is to display the time of completion, e.g. that it will finish at 3:00 PM today. Calendars are better than ETA's because they let us plan in advance and think about all of life's routines as opposed to the task at hand. There's some debate over whether a clock time is shorter. In practice, estimates will be inexact, and you'll need a confidence interval. So far I haven't seen anybody implement progress estimation using anything approaching statistics... It's really the only way to display time; the progress bar is useless, because it only shows how much time the user has sunk in already. Even in an early study on progress bars, the suggestion is made to display a simple time estimate instead of a progress bar.

Technology hijacks people's minds; is watching a progress bar tick really the best use of their time? Optimizing for software satisfaction leads to hidden costs in other areas of life.

Corroborating evidence comes from a study of keyboard vs mouse: the mouse was easy to use and was objectively faster, but, due to its low cerebral engagement, was rated poorly by users. On the other hand, the keyboard required remembering complex shortcuts, which took significant cognitive processing. But this time was ignored in subjective evaluations, resulting in users thinking that the keyboard was faster. User satisfaction would be optimized by keyboards. But user productivity would be optimized by mice. But, only in the short term; more recent studies suggest that, with experience, keyboard shortcuts are faster than the mouse. So the choice is best phrased as an investment decision: spend more time now for a better memory later, or walk away quickly and cut your losses.

Obviously, if the software will take several days to complete, it is pretty much impossible to remain engaged and you should always switch tasks. Similarly if it's below the threshold 0.1 seconds then maintaining flow is paramount. But in between, we enter a much more complex world than a simple progress indicator. Questions like: How should users spend their attention? Is frequent task-switching a good idea?

Model for why spinners reduce attention span:
  • the animated spinning engages the user's attention
  • the default-mode network is thus less active, fires less often, and so it feels as if not much time has passed
  • the timing from the motor network fires more often to track the on-screen activity

A solution for semi-autonomous vehicles

Today, there are many discussions around self-driving cars and whether they can be trusted to take over from people. Although researchers are working hard to change this question into the reverse ("Why should humans drive when the computers do it so much better?"), there will (probably) always be a need for manual driving; for example, the car would have to be driven by hand to the repair shop when an important sensor breaks.

The problem, of course, is that if the car is doing most of the driving, then humans will be unprepared for the rare occurrence when it does not. The most fanciful depiction of this is probably the Disney movie WALL-E; the humans have retreated to self-driving floating armchairs, and barely even recall how to walk. As shown in that movie, though, the situation is unstable; if the systems stop working, which in WALL-E's case was as simple as a new robot bumping into one of the chairs, humans are adaptable enough to learn complex control systems on-the-fly and take back control.

But, of course, it is possible that humans could be injured or killed in this (re)learning process. For the most part, this has been worked around; e.g. car companies designed safety features such as seatbelts and airbags into their cars. But these are not sufficient; there are still many non-fatal injuries, and unlike with bumper cars, real cars cost a lot of money to fix when they crash into each other (exactly why this is so is up for debate).

So, I present the solution: video games; in particular, car racing games. Supposing that, in an autonomous car, the controls will be disconnected, this frees them up to be used for other purposes. By adding transparent LCD screens to all the windows and utilizing the already-present sound system and computer, a decent video game can be made even better through an immersive in-car experience. Furthermore, since it utilizes the existing car controls and view mechanisms, it ensures that the driver is well-acquainted with what to do in case of manual control.

Existing car games are already headed in this direction; dedicated vehicle gamers have a custom steering wheel, electronic pedals, and even a stick shift, for those who like manuals.

It seems simple enough; why drive your boring, slow routine route when instead you could be racing down the freeway, narrowly avoiding the flaming wrecks of other cars and dodging the oncoming fire of a police helicopter? Considering the level of skill required by these video games, transferring to manual control will be a piece of cake; for those who have things to do besides play racing games, a few minutes a day would likely be sufficient to maintain the necessary skill level.

As usual, I have no clue to why this hasn't happened; a similar system could easily be built for pilots, who already do very little manual flying. Instead, though, plane crashes continue to happen, primarily due to pilot error, while those pilots who actually do bother to play airplane simulator games, and then go on to use those skills to recover from unexpected events in their day-to-day flying, are lauded as heroes who went above and beyond their job description.

Now, I'm not saying these people don't deserve recognition; most video games include a leaderboard or a high score feature for that very reason. But, when they appear in the newspaper, rather than the video game forums, I think there's a bit of a problem. Video games can and do save lives; let's make them part of the job, rather than the main event.

Data is abstract

Take a hard disk. Print it out on a sheet of paper. It's just a long string of bits. The processor does nothing but shuffle around these bits, using some of the bits to interpret the other bits.

DNA is the same; instructions to build proteins to build cells and build more DNA.

The interesting parts are the concrete details; what kind of machine gets built. And they're not really in there; looking at machine will tell you what kinds of instructions there are, but not how to interpret them.

Teeth Care

(There are highly-abbreviated notes loosely based on "Kiss Your Dentist Goodbye". Read the book or google for clarifying details.)

  • Tooth decay could be called an epidemic 
  • widespread, not really treated
  • almost all adults, even those flossing regularly, eventually get dental disease
  • 1/5 Americans rate dental health as fair to poor
  • 1/4 of young people have gum disease
  • tooth decay 5x more common than asthma in childhood
  • All sorts of diseases have been linked to it: cancer, acid reflux, heart problems, high blood pressure, stroke, insulin instability, infertility, premature birth, pancreatic cancer, bowel problems.
  • Health care systems mostly suck, incentivize expensive treatments instead of prevention - good for research (and researchers), bad for the people involved

Identifying a good dentist

Despite name of the book (implying that you never need see your dentist again), she's a dentist and still recommends you see one occasionally.

A good dentist:
  • prevents problems, avoids drilling; if treatment is necessary, chooses minimally invasive procedure
    • avoids the common error of filling a perfectly sound tooth
    • Identifies fillings when damaged by acidity (tooth around it erodes, comes loose) - can offer array of options, avoids using toxic chemicals such as mercury
    • ideally: screens to help you prevent cavities, does not handle treatments or fillings directly (thus no conflict of interest)
    • compare "drill, fill, cover" vs. leaving it in place and covering w/ porcelain pastes
  • is skeptical of industry claims, communicative, source of info, experienced, knowledgeable, caring, effective, etc.
  • believes in prevention, remineralization
  • "mouth fitness trainer"
  • interviews patients regularly to discover cause of dental damage
  • has special equipment
    • ultrasound depth testing, Inspektor dental light, digital imaging fiber-optic trans-illumination (DIFOTI), DIAGNOdent laser (kavo usa), inspektorpro, x-rays, ...
    • see cavities, weakened areas
    • measure tooth strength/thickness
    • see at regular intervals
    • provides advance warning/praise
  • uses blunt instrument to check for rough spots, not explorer - see article "Should a Dental Explorer be Used to Probe Suspected Carious Lesions?"
    • explorer - pushing sharp point into weakened area makes it harder for tooth to repair itself
    • sticky spots not reliable diagnosis for cavity - only 24/100 w/ cavity in one study
  • hunts for new dental ideas or methods to stop dental problems
    • at least: dental school, journals, and education programs
    • attends lectures on preventative care
    • interacts with other dental professionals
    • reads (some of) Dentistry Journal, J of ADA/Calif DA, J of D Education/Research, General/Pediatric Dentistry, Caries Research, Archives of Oral Biology, FEMS Microbio Reviews,  J of Clinical Microbio, Infectious Immunology, J of Clinical Pediatric Dentistry, oral health and preventative dentistry, Micro-organisms of human mouth, J of Clinical Periodontology, A J Epidemiology, J of Endodontics, Annals of Pharmacotherapy, 
  • Cleanings make bacteria attach more easily, but also remove a significant amount of them. Unclear if they're beneficial, if you have a good home care routine. (if you don't take care of your teeth then of course they help...) 
old method of fillings - cut grooves into tooth to retain filling
new method - etch, fill pores w/ plastic resin ("sealant")
sealants useful for small cavities, pits, grooves - worry about bacteria though

    Minitutorial on teeth and how they decay

    Structure of tooth is similar to egg - shell corresponds to enamel - immerse in vinegar, shell turns to rubber (but does not vanish; just breaks really easily)
    soft teeth look dark or yellowish, just need time/care to harden/lighten - don't use bleaching agents
    note that fluorescent lights make teeth look yellow regardless

    tooth parts (outside to inside):

    • Plaque - mesh/biofilm of protein strands, many bacteria types, and other substances, fluids, and cells; can have a protective or harmful effect on teeth
    • enamel - continuously changing mesh of watery film and mineral crystals (calcium hydroxyapatite - key elements calcium and phosphate)
      • in presence of fluoride, crystals form faster, structure is calcium fluorapatite - larger, stronger, smoother, more symmetric, and shinier crystals
      • acid dissolves both types, some is normal but too much is bad
      • porous teeth are sensitive, fragile, and temperature-sensitive
      • demineralization/remineralization - shrinkage/growth of crystals -acid demineralizes, saliva remineralizes
      • usually clear, like glass
    • dentin - softer than enamel, very porous, creamy white, tubes
    • pulp - soft living tissue w/ blood supply - odontoblasts
    • gum - seals roots off from rest of mouth, protects roots

    Caries

    • bad bacteria transferred by contact w/ infected saliva on food, utensils, hands, etc.
      • There are ~700 species of bacteria, mostly competing for resources in the mouth. Their functions are still an active research area, but it's clear that some are worse than others in terms of cavities, and you want to get rid of those, e.g. Streptococcus mutans and some lactobacilli. Yeast is another possibility.
    • bacteria attach to a hard, non-shedding tooth surface
    • eating - bacteria process some of the sugar and produce acid
    • acid eats away at the nearby portions of tooth, weakening it and eventually causing cavities
    • bacteria cause gum disease too, attach near gum/tooth line instead of on tooth

    Signs that you have a problem (from bad to worse):

    • gingivities - mild inflammation of gum, 1/7 adults
    • enamel on outside surface of back molar teeth chips away (where teeth bend and flex)
    • back teeth are sensitive
    • bleedings gums
    • periodontis - severe inflammation of gums
    • periodontal pockets form
    • fillings fail and need replacement
    • gums need extra cleaning
    • gum recession, exposed roots showing cementoenamel junction
    • root-canals and crowns
    • extractions, implants, bridges, dentures

    Ways to prevent:

    (all of these happen naturally, but you can help the process by being conscious of it and using various products)
    1. Control which bacteria you have - don't share saliva, remove infected clumps of bad species, eat clean food
    2. Prevent bacteria from attaching to teeth - brushing, flossing (questionable), chew gum, protective sealants, fillings
    3. Kill the bacteria - xylitol, antiseptic rinses, less mouth sugar/food, immune system
    4. Protect teeth - fluoride, pH, minerals, saliva flow (gum, ...), protective rinses

     Methods

    Fluoride

    • strengthens teeth. benefits mostly when in direct contact w/ outside of tooth, for as long as possible
    • good for teeth in moderation (toothpaste!)
      • extreme amounts can cause fluorosis in anyone
      • fluoride before age 3 can poison ameloblasts (teeth cells) and cause even more problems
      • breast milk has low fluoride, infant formula might have high fluoride - bad
    • types:
      • sodium fluoride - well studied, pretty safe, more expensive than other types
      • stannous fluoride - reduces gum inflammation, but brown/black staining of teeth
      • silicon fluorides - not well studied (commonly found in fluoridated water)
    • fluoride sources - foods, sodas, beer, infant formula, powdered iced tea, ...
    • Fluoride rinse - last thing before bed, first thing in morning; spit at least twice to remove extra stuff
      • recommendation: dilute ACT 0.05% fluoride, with no alcohol
      • very little is needed, just enough to coat the tooth surfaces (a few drops)
      • rinsing more often w/ fluoride gives better results
    • Topical high-concentration rinse doesn't do much for healthy teeth.
    • Fluoride gels/foams only effective when applied for >4 minutes on disease-laden teeth
    • fluoride varnish - recent option for low-dose fluoride, numerous studies touting effectiveness
    • Fluoridated water... but:
      • tends to use less-studied (cheap) fluorides, which might have adverse health effects (e.g. heavy metal poisoning)
      • can't control - it's better to filter your tap water and buy your own (sodium) fluoride

      Behavioral Saliva /  PH Control

      • Probably the most effective, after fluoride.
      • Measure saliva pH (litmus, special probe), also amount (saliva buffer kit)
        • To take mouth acidity reading: 
        1.  Spit saliva into spoon
        2.  Test w/ pH detector
        •  do when you wake up (base pH, should be neutral or alkaline, close to 7, <6 is worrying), then 10-minute intervals over course of day to see how drinks/foods change the pH - typically return to normal takes ~30min, quicker is better
      • Know pH of liquids you commonly drink (e.g. the water)
      • Saliva contains minerals for rebuilding teeth (remineralization), lubricates teeth so they don't grind while eating; normal saliva contains all the needed minerals, specifically rinsing w/ minerals is generally unnecessary
      • dry mouth is related to dry esophagus, leaving it open to bacteria or fungi which could give symptoms of acid reflux
      • healthy saliva is neutral or alkaline; should return acidity to safe levels ~30 minutes after eating
      • saliva flow increases at mealtimes and reduces during sleep, varies according to person and situation
      • stress thickens saliva and make your mouth dryer - go to sauna/beach, practice meditation/relaxation, frequent exercise

      Good foods:
      • potatoes, asparagus, broccoli
      • fresh veggies/fruits, veggie juices
      • herbs
      • vitamins/minerals, and waters with them
      • whole grains
      • bananas, almonds, fresh apples, pineapple
      • milk, cheese, other dairy products
      • tea, coffee
      • chocolate, licorice, pure cranberry juice - intense sweeteners
      • alkaline soups/broths/water
      Non-food stuff:
      • propolis (bee product)
      • chewing gum
      • plant fibers/leaves - even chewing sugarcane is good
      Bad stuff:
      • acidic food
      • acidic drinks (worst to OK)
        • frozen fruit juice
        • lemon juice, lemonade
        • citric, apple, and grape juices - even diluted they still cause problems
        • soda, sports drinks, coffee, beer
      • sugar/carbohydrates (if bacteria present)
        • Halloween candy - best to eat it all at once (unless you're diabetic)
      • corrosive, abrasive, or whitening oral care products 
        • includes Listerine, don't leave it in your mouth
        • bleaching - horrible - damages enamel - sensitive teeth, inflamed gums, gum recession, etc.
      • sugarless products (diet soda, sugarless cookies)
        • sorbitol causes gastric problems and feeds the bacteria too
      • gastric acid
      • grinding teeth stresses them and causes problems

      Ellie's 3-Rinse Care Procedure

      (2x / day, once before sleeping and once ~12 hours later)
      1. Prerinse with pH-balanced/stabilized unflavored chlorine dioxide rinse (Closys/Retardex)
        • salt water probably would work too
        • baking soda,peroxide - sensitize gum, don't work
      2. Brush teeth, in particular gum-tooth edge, all the way around the mouth
        • Use toothbrush - head <1 inch in length, easily-grasped handle, soft/giving bristles w/ round ends, should be able to reach upper outside and lower inside easily
        • Toothpaste - old-fashioned, boring, low-chemical, low-tech, no abrasives, few additives, no whitening, "gentle", sodium fluoride, ADA seal
          • dicalcium phosphate dehydrate- abrasive 
          • recommend Crest Regular Cavity Protection
        • Brush bleeding gums, heals in a few days if bacteria are removed
        • use warm water/prerinse + soft cloth instead of toothbrush if sensitive
      3. Disinfect toothbrush (1x/day)
        • Swish bristles in 0.5oz undiluted antiseptic/antibacterial rinse (Listerine) for 30 seconds
        • Rinse off w/ tap water
        • Alternatively: use UV box
      4. Store toothbrush w/ head upright, in cup, allowing bristles to dry completely before using again
        • ensure head doesn't touch other brushes to avoid contamination
      5. Use antiseptic rinse (listerine), swishing around everywhere in the mouth
        • should have ADA seal, good taste, no whitening/abrasives - can dilute if needed
        • Spit out, don't rinse
      6. After antiseptic, immediately use protective anticavity rinse, esp. before sleeping
        • 0.05% sodium fluoride ACT
        • goal is to rebuild teeth
        • don't wash off afterwards, keep on as long as possible
        • swishing toothpaste around your mouth w/ a small amount of water can be used instead of a rinse, but does require spitting it out again
      The toothbrush breaks up plaque films and rinsing afterwards mechanically removes most bacteria. Flossing breaks up plaque as well, but it's not particularly effective (it's mostly good for removing food particles). However, the toothbrush is inadequate for periodontal pockets, only goes ~4mm deep. A Waterpik works but breaks far too easily; the antiseptic mouthwash works pretty well for gum pockets. Also see Periogen, not mentioned by Ellie but seems effective at periodontal restoration / prevention (it has a cult internet following, although it's overpriced). Similarly sodium hexametaphosphate inhibits calculus and loosens extrinsic stains, and in general there are lots of interesting rinse additives to explore.

      Xylitol

      wood sugar, available in specialty stores
      Sciency mumbo-jumbo:
      • antibacterial effects
      • less buildup of plaque for some reason
      • 5g had strong effects, even with a 3 month break
      • 6.5g a day - after 5 wks, reduced; afer 6 months, bacteria gone. for 2 years, plaque reduced significantly - no buildup at all.
      • past 10g/day, no generic effects, but some suggest for calcium absorption
      • xylose + other 8 sugars precursors to some important proteins
      • also reduces ear infections
      • stimulates saliva flow like other foods 
      • 15g naturally produced by body (though not in saliva)
      • 100g/day eaten w/out obvious ill effects

      Ellie's website (Zellie's) sells xylitol wipes, gum, mints, rinses, etc., obvious conflict of interest. She recommends 6-10g/day in 3-5 doses. Buying in bulk from her website, the cost per day ranges from 75 cents (gum) to 48 cents (mints) to 13 cents (granular xylitol). For comparison, the general recommendation is to use 1g of toothpaste and brush twice a day, so your typical $3 232g tube of Crest Regular Cavity Protection toothpaste is only 2.5 cents a day, and 20ml of $5/L Listerine mouthwash once a day is 10 cents a day.

      Thoughts on Google I/O 2016 Keynote

      So, I watched the Google I/O 2016 Keynote. As usual, my thoughts are different from other people, so it's worth writing them down.
      • Music: those were some cool people in the beginning. But Google can't find their music, and they have no credits in the schedule. What gives?
      • Intro movie: reasonable, I guess it was a spin on the play store. Dubstep's still not my thing.
      • Knowledge Graph: still not useful enough to disambiguate "simon haskell" into "simon peyton jones" and "simon marlow". And considering the reasons for the removal of the 'phonebook' operator, I'm not sure it ever will.
      • Machine learning: it's (mostly) open source, no real objections here
      • Buying from movie theaters: Is this still a thing, in 2016? What's wrong with Netflix? I assume Netflix can give much better movie recommendations than Google (although it would be nice to have competition), and unlike Google there aren't any difficulties with availability.
      • Ordering food: the ordering part is ok, but I'd rather have it show up as a persistent notification than as a text bubble
      • Google Home: The majority of examples there should be automated; telling a speaker to turn on the lights every morning is tedious. The flight planning stuff and sensor control seems like it would work better with a touchscreen.
      • Allo: the intelligent completion should be in the system-wide keyboard, rather than the messaging app. Too late now I guess.
      • Duo: same here, improve the platform rather than the app
      • Watch: sounds like watches are the new phones. but do they make calls?