# _CoVSCode_: A Novel Real-Time Collaborative Programming Environment for Lightweight IDE
## 5 Major Technical Issues and Solutions
### Client System Architecture and Major Components  
Given the overall system architecture (Section 4.1), the _CoVSCode_ client adaptor plays a critical role in supporting real-time collaboration. As illustrated in Figure 3, the client adaptor has been designed with eight major functional components. Some of the components invoke APIs provided by the three modules in the underlying _VS Code_ IDE, which are indicated by the labeled arrows (each letter refers to a corresponding item in Table 1 above).  
The _File-Level RTCP Controller_ (the term RTCP represents \"real-time collaborative programming\" in this figure) detects local operations and replays remote operations in source code editors for supporting file-level sessions. The _Project-Level RTCP Controller_ detects local operations and replays remote operations in the IDE's project explorer (i.e., the source code tree) for supporting project-level sessions. The _RTCP Awareness Controller_ retrieves the local programmer's editing cursor and/or highlight range, displays all remote programmers' editing cursors and/or highlight ranges, and delivers notification messages for supporting real-time collaboration awareness features (visually presented in Section 6.1.3). The _Operational Transformation Controller_ is the key to supporting consistency maintenance of the source code, with the OT technique as the cornerstone (see Section 2.1). Technically, each local editing operation will be processed by the controller, and each remote editing operation will be transformed by the controller before its replay.  
The _Local Operation Processor_ (LOP) integrates four controllers, and is dedicated to detecting and propagating local editing operations performed by the local user in the source code. When the user opens a source code file in the editor, the component registers a specific listener with the source code editor in the initialization procedure. Consequently, whenever the local user issues an editing operation in the programming process, the listener captures the changes that have occurred in the source code. It is worth noting that one editing operation may result in one or many changes, depending on the actual situations. The changes are then processed by the operational transformation controller, and transmitted to the server for propagation to all collaborating sites within the same session.  
The _Remote Operation Processor_ (ROP) also integrates the four controllers, and is dedicated to applying remote editing operations performed by remote users to the local source code. Each remote editing operation that arrives is firstly processed by the operational transformation controller, and then replayed in the source code file, which immediately becomes visible in the user interface.  
Given each source code file that is being edited, there will be a pair of parallel threads that correspond to the LOP and ROP, as illustrated in Figure 4. The two processors involve some shared  
Figure 3: The _CoVSCode_ client system architecture and major functional components.  
components, such as several _VS Code_ modules (for invoking APIs) and the operational transformation controller (for processing and transforming operations). Certain mechanisms (e.g., mutex, semaphore) are needed to control the parallel execution of both threads and serialize concurrent access to the shared components in the system.