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:
- 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.
- 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.