Refactoring is a crucial technique for improving the efficiency and maintainability of software by restructuring its internal design while preserving its external behavior. While classical programs have benefited from various refactoring methods, the field of quantum programming lacks dedicated refactoring techniques. The distinct properties of quantum computing, such as quantum superposition, entanglement, and the no-cloning principle, necessitate specialized refactoring techniques. This paper bridges this gap by presenting a comprehensive set of refactorings specifically designed for quantum programs. Each refactoring is carefully designed and explained to ensure the effective restructuring of quantum programs. Additionally, we highlight the importance of tool support in automating the refactoring process for quantum programs. Although our study focuses on the quantum programming language Q\#, our approach is applicable to other quantum programming languages, offering a general solution for enhancing the maintainability and efficiency of quantum software.
翻译:重构是一种通过重新设计软件内部结构同时保留其外部行为,从而提高软件效率和可维护性的关键技术。虽然传统程序已受益于各种重构方法,但量子编程领域尚缺乏专门的重构技术。量子计算的独特特性(如量子叠加、纠缠和不可克隆原理)需要专门的重构技术。本文通过提出一套专门为量子程序设计的综合重构方法,填补了这一空白。每种重构方法都经过精心设计和解释,以确保量子程序的有效重组。此外,我们强调了工具支持在自动化量子程序重构过程中的重要性。尽管本研究聚焦于量子编程语言 Q#,但我们的方法同样适用于其他量子编程语言,为提升量子软件的可维护性和效率提供了通用解决方案。