Avoid "Spooky Action at a Distance" in Software

  • in physical world you can only touch what is in your arms reach, and you have to physically move to get to something that's out of that reach
  • in software there's no real notion of distance, and "spooky action at a distance" happens when:
    • clicking in one part of the screen results in a change in some distant part of the screen, e.g. a bottom right button to add a new note, which creates it in the top-left corner of the window
      • one counter-example is configuring Vim in a way that a file picker opens in the buffer that you're actively editing, instead of popping up a sidebar with a file listing - this doesn't require your eyes to move anywhere, and you know where the new file will appear (in the split you're seeing the file picker)
      • in general results of your actions should be localized to where you take these actions
    • when programming you can call any other function, or ask for any other data point, even if they are "conceptually distant" from where you "are" right now
      • data and code should be "co-located" as much as possible (ideally also embodied)
      • importantly, VPLs - "node and edges" ones - are not a solution here: they swap variable names for drawing edges, but the idea stays the same - you can touch anything immediately, regardless of how "far" it is
Szymon Kaliski © 2021