Code clones, referring to identical or similar code fragments, have long posed challenges in classical programming, impacting software quality, maintainability, and scalability. However, their presence and characteristics in quantum programming remain unexplored. This paper presents an empirical study of code clones in quantum programs, specifically focusing on software developed using the Qiskit framework. We examine the existence, distribution, density, and size of code clones in quantum software, revealing a high density of Type-2 and Type-3 clones involving minor modifications. Our findings suggest that these clones are more frequent in quantum software, likely due to the complexity of quantum algorithms and their integration with classical logic. This highlights the need for advanced clone detection and refactoring tools specifically designed for the quantum domain to improve software maintainability and scalability.
翻译:代码克隆,即指相同或相似的代码片段,长期以来在经典编程中一直构成挑战,影响软件质量、可维护性和可扩展性。然而,其在量子编程中的存在与特性仍未被探索。本文对量子程序中的代码克隆进行了实证研究,特别聚焦于使用Qiskit框架开发的软件。我们考察了量子软件中代码克隆的存在性、分布、密度与规模,揭示了涉及微小修改的Type-2与Type-3克隆具有高密度。我们的研究结果表明,这些克隆在量子软件中出现更为频繁,这很可能源于量子算法的复杂性及其与经典逻辑的集成。这突显了需要专门为量子领域设计的高级克隆检测与重构工具,以提升软件的可维护性与可扩展性。