Pages

20180405

Visualizing Algorithms by Mike Bostock

Visualizing Algorithms
  • Visualization leverages the human visual system to augment human intellect: we can use it to better understand these important abstract processes, and perhaps other things, too.
  • When deciding whether to use an algorithm, we evaluate it not in a vacuum, but against other approaches. And as a practical matter it is useful to weight the complexity of implementation --how long it takes to implement, how difficult it is to maintain--against its performance and quality.
  • While formal description has its place in unambiguous documentation, visualization can make intuitive understanding more accessible.
  • Being able to see what your code is doing can boost productivity.
  • Visualization does not supplant the need for tests, but tests are useful primarily for detecting failure and not explaining it.
  • Visualization can also discover unexpected behavior in your implementation, even when the output looks correct.
  • Even if you just want to learn for yourself, visualization can be a great way to gain deep understanding. Teaching is one of the most effective ways of learning, and implementing a visualization is like teaching yourself.
  • Showing a single run of the algorithm does not effectively asses the quality of its randomness.
  • Sorting is the inverse of shuffling: it creates order from disorder, rather than vice versa.
  • While intuitive, animation can be frustrating to watch, especially if we want to focus on an occasional weirdness in the algorithm's behavior.
  • Animations also rely heavily on our memory to observe patterns in behavior. While animations are improved by controls to pause and scrub time, static displays that show everything at once can be even more effective. The eye scans faster than the hand.
  • A simple way of turning an animation into a static display is to pick key frames from the animation and display those sequentially, like a comic strip.
  • So, why visualize algorithms? Why visualize anything? To leverage the human visual system to improve understanding. Or more simply, to use vision to think.

No comments:

Post a Comment