Research of possibilities of default refactoring actions in Swift language

Authors

DOI:

https://doi.org/10.15587/2706-5448.2022.266061

Keywords:

Swift programming language, refactoring, open-source code, sourcekit component

Abstract

The object of research in the paper is a built-in refactoring mechanism in the Swift programming language. Swift has gained a lot of popularity recently, which is why there are many new challenges associated with the need to support and modify the source code written in this programming language. The problem is that the more powerful refactoring mechanism that can be applied to Swift is proprietary and cannot be used by other software. Moreover, even closed-source refactoring software tools are not capable of performing more complex queries.

To explore the possibilities of expanding the built-in refactoring, it is suggested to investigate the software implementation of the sourcekit component of the Swift programming language, which is responsible for working with «raw» source code, and to implement new refactoring action in practice. To implement the research plan, one refactoring activity that was not present in the refactoring utilities (adding an implementation of the Equatable protocol) was chosen. Its implementation was developed using the components and resources provided within the sourcekit component. To check the correctness and compliance with the development conditions, several tests were created and conducted.

It has been discovered that both refactoring mechanisms supported by the Swift programming language have a limited context and a limited scope and application. That is why the possibility of expanding the functionality should not be based on the local level of code processing, but on the upper level, where it is possible to combine several source files, which often happens in projects. The work was directed to the development of the own refactoring action to analyze and obtain a perfect representation of the advantages and disadvantages of the existing component. As a result, a new approach to refactoring was proposed, which will allow solving the problems described above.

Author Biographies

Andrii Tkachuk, National Technical University of Ukraine «Igor Sikorsky Kyiv Polytechnic Institute»

Postgraduate Student

Department of System Design

Bogdan Bulakh, National Technical University of Ukraine «Igor Sikorsky Kyiv Polytechnic Institute»

PhD, Associate Professor

Department of System Design

References

  1. Sandoval Alcocer, J. P., Siles Antezana, A., Santos, G., Bergel, A. (2020). Improving the success rate of applying the extract method refactoring. Science of Computer Programming, 195, 102475. https://doi.org/10.1016/j.scico.2020.102475
  2. Kaur, G., Singh, B. (2017). Improving the quality of software by refactoring. 2017 International Conference on Intelligent Computing and Control Systems (ICICCS), 185–191.
  3. Saca, M. A. (2017). Refactoring improving the design of existing code. 2017 IEEE 37th Central America and Panama Convention (CONCAPAN XXXVII). doi: https://doi.org/10.1109/concapan.2017.8278488
  4. Simmonds, J. (2002). A Comparison of Software Refactoring Tools. Available at: https://www.researchgate.net/publication/2946408_A_Comparison_of_Software_Refactoring_Tools
  5. Chouchen, M., Olongo, J., Ouni, A., Mkaouer, M. W. (2021). Predicting Code Review Completion Time in Modern Code Review. ArXiv. doi: https://doi.org/10.48550/arXiv.2109.15141
  6. Inoue, K., Roy. C. K. (2021). Code Clone Analysis. Singapore: Springer. doi: https://doi.org/10.1007/978-981-16-1927-4
  7. Swift Issues. Available at: https://github.com/apple/swift/issues/
  8. Lacerda, G., Petrillo, F., Pimenta, M. S., Guéhéneuc, Y. (2020). Code Smells and Refactoring: A Tertiary Systematic Review of Challenges and Observations. ArXiv. doi: https://doi.org/10.48550/arXiv.2004.10777
  9. Swift Local Refactoring. Available at: https://swift.org/blog/swift-local-refactoring/
  10. Improving Swift Tools with libSyntax. Available at: https://academy.realm.io/posts/improving-swift-tools-with-libsyntax-try-swift-haskin-2017/
Research of possibilities of default refactoring actions in Swift language

Downloads

Published

2022-10-24

How to Cite

Tkachuk, A., & Bulakh, B. (2022). Research of possibilities of default refactoring actions in Swift language. Technology Audit and Production Reserves, 5(2(67), 6–10. https://doi.org/10.15587/2706-5448.2022.266061

Issue

Section

Information Technologies: Reports on Research Projects