Usage of formalized knowledge about source code for refactoring actions in Swift

Authors

DOI:

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

Keywords:

Swift programming language, knowledge base, analysis and refactoring tools, open-source code

Abstract

The object of research in the paper is the source code of a software product written in the Swift programming language. Most programs as a product of a certain project during the life cycle require changes and modifications, which is costly or impossible to implement in the case of poor code quality. One of the options for solving the problem of poor code quality is the timely application of refactoring principles. The existing problem is that implementation of high-level refactoring must be done manually by the developer without the use of automated tools as built-in solutions cannot fulfill the need due to the architectural complexity of the product.

To reduce the number of errors made during refactoring, to simplify the process of performing routine actions, it is suggested to use a new software product for refactoring. It works with high-level user commands based on a formalized description of the source code together with a knowledge base containing a description of code entities and their properties (what specific actions can be performed with them). In the work, the refactoring of the source code was carried out using the example of the Swift programming language. The proposed approach of component architecture (knowledge base, software engine) further allows to expand the functionality of the software product to other programming languages.

The work was directed to the development of a prototype of a software product using the proposed approach to check and compare the results with other refactoring tools. A command line utility has been developed that accepts a verbal command as an input and outputs the results of processing and analysis of the source code (search for complex structures in the code) or applies the proposed change. As a result of the conducted testing, it was established that the use of the proposed approach allows performing complex refactoring tasks with the help of a simple verbal formalized command. Accomplishing the same task using only the built-in refactoring tools requires significantly more time and effort or is impossible at all.

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. Swift Documentation. Swift Local Refactoring. Available at: https://www.swift.org/blog/swift-local-refactoring/
  2. Lacerda, G., Petrillo, F., Pimenta, M., Guéhéneuc, Y. G. (2020). Code smells and refactoring: A tertiary systematic review of challenges and observations. Journal of Systems and Software, 167. doi: https://doi.org/10.1016/j.jss.2020.110610
  3. Almogahed, A., Omar, M., Zakaria, N. H. (2022). Refactoring Codes to Improve Software Security Requirements. Procedia Computer Science, 204, 108–115. doi: https://doi.org/10.1016/j.procs.2022.08.013
  4. Code refactoring best practices. Available at: https://www.altexsoft.com/blog/engineering/code-refactoring-best-practices-when-and-when-not-to-do-it/
  5. Kaur, S., Singh, P. (2019). How does object-oriented code refactoring influence software quality? Research landscape and challenges. Journal of Systems and Software, 157. doi: https://doi.org/10.1016/j.jss.2019.110394
  6. Fowler, M. (1999). Refactoring. Improving the Design of Existing Code. Addison-Wesley, 63.
  7. Morales, R., Soh, Z., Khomh, F., Antoniol, G., Chicano, F. (2017). On the use of developers’ context for automatic refactoring of software anti-patterns. Journal of Systems and Software, 128, 236–251. doi: https://doi.org/10.1016/j.jss.2016.05.042
  8. Don, R., Brant, J. Refactoring tools. Available at: http://www.laputan.org/pub/patterns/fowler/Roberts-Brant.doc
  9. De Nicola, R., Di Stefano, L., Inverso, O., Uwimbabazi, A. (2022). Automated replication of tuple spaces via static analysis. Science of Computer Programming, 223. doi: https://doi.org/10.1016/j.scico.2022.102863
  10. Hammad, M., Babur, Ö., Basit, H. A., van den Brand, M. (2022). Clone-Writer: An effective editor for developing code by using code clones. Software Impacts, 13. doi: https://doi.org/10.1016/j.simpa.2022.100323
  11. Al Dallal, J. (2012). Constructing models for predicting extract subclass refactoring opportunities using object-oriented quality metrics. Information and Software Technology, 54 (10), 1125–1141. doi: https://doi.org/10.1016/j.infsof.2012.04.004
  12. Swift Syntax Command Line Tool (2019). Available at: https://www.pointfree.co/episodes/ep55-swift-syntax-command-line-tool
  13. Almeida, L. (2019). An Overview of SwiftSyntax. Available at: https://medium.com/@lucianoalmeida1/an-overview-of-swiftsyntax-cf1ae6d53494
  14. Mattt (2018). SwiftSyntax. Available at: https://nshipster.com/swiftsyntax/
  15. SwiftSyntax Documentation. Available at: https://github.com/apple/swift-syntax/tree/main/Documentation
  16. A set of Swift bindings for the libSyntax library. Available at: https://iosexample.com/a-set-of-swift-bindings-for-the-libsyntax-library/
Usage of formalized knowledge about source code for refactoring actions in Swift

Downloads

Published

2022-11-17

How to Cite

Tkachuk, A., & Bulakh, B. (2022). Usage of formalized knowledge about source code for refactoring actions in Swift. Technology Audit and Production Reserves, 6(2(68), 6–10. https://doi.org/10.15587/2706-5448.2022.267160

Issue

Section

Information Technologies