October 16, 2021

Design

Algorithms vs Heuristics

Steve Jobs, and by extension Apple, have been a huge proponent of operating at the intersection of technology and liberal arts. Ken Kocienda was a developer who worked on Safari and the original iPhone. In his book Creative Selection, he says that they used the word "heuristic" to describe some aspects of software development that tipped toward liberal arts. For instance, the duration of an animation.

Both algorithms and heuristics are techniques to solve a problem. Algorithms are objective. They are clearly defined steps that lead to the same results every time. Heuristics are subjective – loosely defined guidelines or rules of thumb. They depend on an individuals taste, and personal experiences.

“The reason Apple can create products like the iPad is that we’ve always tried to be at the intersection of technology and liberal arts.”

Steve Jobs

What Are Algorithms?

Algorithms are well-defined instructions to solve a problem or to perform a computation. They provide quantifiable results and are objective in nature. With algorithms, progress measurements moving in a predetermined directions determine progress. For instance, lower time in opening a page on web browser is better.

Let's look at an example of how an algorithm helped speed up the original Safari on Mac. Ken Kocienda created a Page Load Test while working on Safari in early 2000s. The program opened up the browser, loaded different kinds of web pages (text heavy, graphics heavy etc) in quick succession. Then it calculated the average loading time for each.

These results helped the Safari evaluate every code change and optimise it for speed. That's how they developed a quick browser for the Mac, launched in 2003.

What Are Heuristics?

Most designers, including myself, can credit our knowledge of the term "heuristic" to Nielsen-Norman Groups' "10 Usability Heuristics for User Interface Design."

The word "heuristic" derives from the Greek word "eureka" which means "to find". Like algorithms, heuristics are another approach to problem solving. They use practical methods and don't rely on optimal, perfect or rational solutions. They provide sufficient solutions for the time being. Trial and error, rule of thumb and educated guesses are some examples of techniques involving heuristics.

Heuristics are subjective in nature. They also have values associated with them, but they depend on a person's design taste and experience. These values aren't better or worse in any engineering sense. The values instead represent sensible defaults or pleasing effects. They are harder to nail down into quantifiable universal numbers. Eg. duration for animation, RGB values for a colour.

A Combination Of Both Leads To The Best Results

In his book Creative Selection, the author says that at Apple they used a combination of algorithms and heuristics to achieve the best results. This circles back to Steve Jobs' proclamation of being at the intersection of technology (algorithms) and liberal arts (heuristics).

The output from a heuristic often became the input to an algorithm whose output, in turn, became the input to the next heuristic.

For example, swiping to the left to see the next image in the Photos app started with using your finger movement to make a judgment call for whether the swipe should go to the next photo or stay on the current one (a heuristic), which fed into animation code to move the photo display to a specific geometric position to center the next photo (an algorithm) starting from a certain speed, given how fast you swiped (another algorithm), and eased the photo to a gentle stop using a carefully designed animation timing (a heuristic).

Ken Kocienda, Creative Selection: Inside Apple's Design Process During the Golden Age of Steve Jobs

References

I am on a quest to improve my writing skills. If you have any suggestions, resources or just want to yell at me, please share via Twitter or LinkedIn. 🙌