# Following the Writer's Path to the Dynamically Coalescing Reactive Chains Design Pattern
## Appendix A Examining Two Existing Solutions
### Dynamic VR Applications  
In the second case study, [PERSON] et al. [5] extended and systematized the research from a preliminary study [64] conducted a few months earlier. This preliminary work also motivated the case study that we examined in the previous subsection. The case study sought to eliminate the instability corresponding to the transitional turbulence that occurs in virtual reality (VR) and augmented reality (AR) applications implemented with C# in the popular Unity3D game engine [11]. These applications are inherently _reactive_ and _nondeterministic_ with respect to how and when the internal mechanism will execute such events and eventually deliver the resulting state. Whenever multiple game objects in the simulated scene interact with each other, it may take several cycles for the VR/AR application to update the states of all components and reach stability. As we discuss for the first case study, this is called transitional turbulence or, sometimes, the \"ripple effect\". Transitional turbulence can result in inconsistencies in what is displayed for the user, which may lead to inconsistent and misleading states within the VR/AR application, making the entire application seem unreliable and unpredictable. The approach focuses on reordering the execution of events so that the \"ripple effect\" can often be resolved within one update cycle. Much of the nondeterminism is due to the unpredictable nature of the user interactions, but some of it is due to the lack of the application developer's control over some aspects of the execution, especially those aspects affecting the order in which events and the responses to those events occur in the system. The removal of this type of nondeterminism yields a more accurate system. This study shows that Unity3D does not provide a mechanism for controlling the order of execution. [PERSON] et al. [5] argues that the ability to change the execution order of components--and, consequently, to enable the correct ordering of the components' executions in a scene graph--is key to achieving highly accurate systems. To be perceived as accurate, simulated interactions must occur in the same order as the interactions would occur in the corresponding real-world situation. If they do not, then the simulation does not seem realistic to the user. Consider a domino chain. When the first domino falls, the second should fall when the weight of the first domino causes it to fall. The third falls similarly, and so forth throughout the chain. If any one of these falls is shown incorrectly, the whole simulated sequence is likely to be perceived as unrealistic. As in the dynamic GUI case study, this case study developed a reactive programming approach to mitigate the transitional turbulence problems. This approach analyzes the complex relationships among the game objects present in the scene hierarchy, encodes these dependencies in a dependency graph, and then uses the graph to rearrange the updates in an order consistent with the dependency constraints. It builds the graph when the application starts up and then rebuilds it whenever it detects that the dependencies might have changed. The approach thus coalesces the processing of a chain of what may be several events in the unmodified system into a single, large-grained event that updates the states of many controls at once. As in the previous case study, because of the nature of the display system, the approach cannot totally eliminate the transitional turbulence that can cause inaccurate or misleading displays, but coalescing multiple events into large-grained events does potentially decrease the number of inaccuracies and increase the system's performance. To evaluate the approach, this case study developed a prototype library and used it to perform several experiments [5]. The experiments involved a three-way comparison among Unity3D applications using their approach, the built-in Unity3D event system, and UniRx, the Reactive Extensions library for the Unity3D platform [12].