Skip to content

Instantly share code, notes, and snippets.

@dglazkov
Last active April 13, 2016 03:15
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dglazkov/fee1dcb9690baf73dff0 to your computer and use it in GitHub Desktop.
Save dglazkov/fee1dcb9690baf73dff0 to your computer and use it in GitHub Desktop.
Multiple-actor Problem

Definition of the Multiple-actor Problem

The Multiple-actor Problem (MAP) occurs in a web application that contains multiple bits of code, each assuming that they are the only actor in the document. The problem manifests when these assumptions conflict with each other.

Some examples:

  • A web app is written in framework A, then later an analytics script B is added. A makes assumptions about lifetime of elements and handling of events. B is not aware of these assumptions and subtly violates them, causing jank (example)
  • A web app is written using framework A. Attempting to introduce a widgets built using framework B results in weird errors, because B is violating A's assumptions about control of document state (examples 1, 2).
  • A popular extension A arbitrarily mutates DOM of a web app, written using framework B. B's consistency invariants depend on its internal model being always in sync with the DOM. The net effect is that neither the app nor A behave as expected when A is installed (example).

The MAP can be broken into two distinct sub-problems:

  1. Conflicting assumptions about amount of work scheduled and degree of control over the main thread lead to jank and unpredictable performance characteristics, aka the Coordination Problem.
  2. Conflicting assumptions about control and state of the DOM tree lead to broken behaviors and the need to explicitly manage interoperability between multiple actors, aka the Composition Problem.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment