Diagnostic code, both temporary debugging code and persistent instrumentation, creates a recurring tradeoff in software engineering workflows. In-source techniques such as assertions, flags, and logging statements are explicit and easy to edit, but clutter production code. Out-of-source techniques such as runtime instrumentation, build transforms, duplicated branches, and temporary uncommitted changes preserve cleaner source files, but are harder to reason about and maintain, especially in collaborative settings. This thesis presents a framework for automatic switching between production and diagnostic code. The core idea is to maintain a canonical structured representation of each file in metadata and generate two synchronized source-level views: debug-on and debug-off. The approach draws inspiration from two-view editors and OT/CRDT-style structured text representations, but applies those ideas to asynchronous, version-controlled software development rather than rendered document editing or real-time collaboration. The framework was implemented as a local VS Code extension and also as a client-server architecture for broader IDE support. Evaluation through automated tests suggests that the local extension preserves intended views with generally low editing overhead, while the client-server model offers greater portability with increased latency. Overall, this work argues that structured diagnostic switching is a feasible and useful direction for collaborative software engineering tooling.
Jack Huo (Tue,) studied this question.