# _CoVSCode_: A Novel Real-Time Collaborative Programming Environment for Lightweight IDE
## 4 System Architecture, Workflow, and Functional Design
### System Architecture  
Following the design objectives above, we herein present the overall system architecture, as illustrated in Figure 2. The proposed environment contains a server and several clients (as many as are needed), which are connected by communication networks. Each client will be used by one collaborator, while the server can be deployed internally within an organization or hosted via a cloud service. To achieve _Design Objective A_ (Section 3.1), we follow the TA approach (Section 2.2), and transparently convert the existing _Visual Studio Code_ (referred to as _VS Code_ hereafter) IDE into a novel real-time collaborative programming environment named _CoVSCode_ without knowing or changing the source code of the original _VS Code_ IDE. Each client consists of an existing _VS Code_ and an additional adaptor that runs as a plugin of the underlying IDE. This ensures that all traditional single-user programming functionalities (e.g., source code editing, compilation, debugging, coding assistance) and user interfaces will be fully preserved. Since _VS Code_ can be used for programming in almost every major programming language (such as Python, C/C++, C#, Java, Go, JavaScript, TypeScript, and many more) [36], the proposed _CoVSCode_ would also be capable of supporting real-time collaborative programming in those major programming languages by nature. In addition, all extra functionalities of real-time collaboration will be embedded in the adaptor, which invokes various application programming interfaces (APIs) provided by the underlying IDE (but does not alter the IDE). In this study, we have selected _VS Code_ based on the following considerations. Firstly, _VS Code_ has been designed with great extensibility by nature [37], and almost every part of the IDE can be  
Figure 2: The _CoVSCode_ system architecture. customized and enhanced by utilizing the _Extension API_ (i.e., programming interfaces provided by the IDE), which meets the fundamental requirements of this work. Secondly, _VS Code_ has been widely used by a large number of developers in the communities [19], which implies the potential value of this work, as well as the opportunities for usability study and evaluation in the future. It is worth noting that all approaches and techniques derived in this work are generic, and can also be applied in building real-time collaborative programming environments for other lightweight IDEs of similar natures (such as _Atom_ and _Sublime Text_), as long as the selected IDE provides necessary API support. In Section 5.1, we will describe what necessary API support is required. To achieve _Design Objective B_ (Section 3.2), major real-time collaboration mechanisms and functionalities will be implemented and distributed in the adaptor of each client. Particularly, to meet the requirement of high local responsiveness, the _replicated architecture_ must be adopted, in which the source code copy is replicated at the local workspace of each site. This ensures that all local editing operations can take effect immediately without communicating with the server. In addition, to maintain source code consistency at all sites, certain mechanisms and techniques will be adopted and implemented in the adaptor. Under the current architecture, each client is directly connected to the server, and consequently, all editing operations are relayed by the server to other collaborating sites, which preserves the cause-effect relationships among editing operations. The server contains (i) a _real-time collaboration service_ (RTCS) component, (ii) a _general service_ (GS) component, and (iii) a _service gateway_ (SG) component which supports communications with clients. The GS component is responsible for managing user accounts, collaborative teams, software projects, and the corresponding source code repositories. The RTCS component is responsible for supporting real-time collaboration, including session management and operation propagation.