Building modern interactive applications often requires a massive amount of "plumbing" code. Developers must manually write logic to ensure that when the underlying data changes, the user interface (UI) updates to reflect it. This synchronization is traditionally imperative: the developer observes an event and then manually manipulates the Document Object Model (DOM) or UI tree.
A growing body of research suggests a more efficient alternative: treating the UI as a materialized view of the application state and using Incremental View Maintenance (IVM) to synchronize them automatically.
The UI as a Materialized View
In database theory, a materialized view is a pre-computed query result that is stored to speed up data retrieval. As Fu et al. argue, a web user interface can be modeled exactly this way. The application state is the source data, and the UI is a visual projection—a view—defined by a declarative template or query.
When the UI is treated as a materialized view, the framework can take over the responsibility of synchronization. Instead of the developer writing code to "delete this row" or "update that label," they simply define the relationship between the data and the display using declarative languages like SQL++ or reactive templates. As Fu et al. demonstrate, this allows the system to automatically calculate the minimal set of changes needed to synchronize the browser's DOM whenever the underlying data changes.
Efficiency through Deltas
The core mechanism that makes this approach performant is the use of deltas. In a naive declarative system, any change to the data might trigger a full re-rendering of the entire UI. This is computationally expensive and destroys user state, such as scroll positions or text focus.
IVM avoids this by computing only what has changed. The process follows a specific logic:
- Detect the Change: The system identifies the "delta" ($\Delta$) in the source data.
- Propagate the Delta: Instead of re-running the entire query, the system uses the delta to update the existing view. Özsoyoglu et al. describe this as a recursive problem where the system computes "deltas of deltas," allowing views to remain fresh even under high-velocity data streams.
- Apply Minimal Updates: In the context of a UI, the framework pushes only the necessary modifications to the client. Fu et al. note that this preserves user-entered data in forms and maintains the visual context, significantly improving the user experience.
This shift from $O(\text{Total Data})$ to $O(\Delta)$ processing is what enables sub-second latency in complex systems. For example, Grafberger et al. apply these techniques to machine learning pipelines, using "shadow pipelines" to provide real-time feedback on code changes by only computing updates relative to the previous pipeline state.
Bridging the Declarative-Imperative Gap
While the declarative approach simplifies high-level logic, real-world applications often rely on imperative third-party libraries (like charts or maps). Fu et al. propose the use of unit wrappers to bridge this gap. These wrappers act as translators, turning the framework's declarative state changes into the specific imperative method calls required by external components.
Similarly, in scientific visualization, Ramachandran highlights how reactive mechanisms are necessary to reduce the boilerplate code required to keep internal data models and graphical elements in sync. By adopting functional reactive programming (FRP) principles, as seen in the work of Ayers et al., developers can treat UI elements as reactive streams of data, further automating the synchronization process.
Beyond the Browser
The principles of incremental synchronization extend beyond traditional UIs into various data-intensive domains:
- Data Mining: Morzy et al. show that refreshing materialized data mining views concurrently as new data arrives eliminates redundant database scans.
- Graph Processing: Zervakis et al. use incremental joins to monitor massive graph streams, avoiding full query re-evaluation by only processing the difference between new updates and existing partial matches.
- Iterative Queries: In distributed environments, Kato et al. use "delta tables" to optimize iterative algorithms like PageRank, ensuring that only the changes between iterations are processed.
By treating the "output" of a system—whether it is a DOM tree, a diagnostic metric, or a graph pattern—as a maintained view of the "input," these frameworks remove the burden of manual synchronization from the developer, leading to more robust and responsive applications.
Key Foundational Work
Incremental Data Mining Using Concurrent Online Refresh of Materialized Data Mining Views (2005) — contributed 1 concept elements to this direction.
Homeviews: peer-to-peer middleware for personal data sharing applications (2007) — contributed 1 concept elements to this direction.