علوم رایانشی

علوم رایانشی

بازسازی خودکار کد زبان اصلی نرم‌افزار برای رفع پادالگوهای زبان‌شناختی مربوط به توابع

نوع مقاله : مقاله پژوهشی

نویسندگان
1 استادیار، دانشکده‌ مهندسی کامپیوتر، دانشگاه علم و صنعت، تهران، ایران
2 دانشجوی کارشناسی ارشد، مهندسی کامپیوتر، دانشگاه علم و صنعت، تهران، ایران
3 کارشناسی ارشد مهندسی کامپیوتر، دانشگاه علم و صنعت، تهران، ایران
10.22034/csj.2025.214934
چکیده
امروزه معیارهای فراوانی برای سنجش کیفیت نرم‌افزار وجود دارد که هر کدام از جهتی به سنجش آن می‌پردازند. وجود یا عدم وجود پادالگوها می‌تواند معیاری برای سنجش کیفیت کدِ زبان اصلی نرم‌افزار باشد. برخی پادالگوهای شناخته‌ شده با توجه به تاثیرشان بر روی کارایی، اطمینان‌پذیری و سایر معیارهای مرتبط مطالعه می‌شوند. یکی از این معیارها، خوانایی کدِ زبان اصلی نرم‌افزار است. سازنده یا سازندگان یک برنامه تنها کسانی نیستند که به توسعه‌ آن می‌پردازند. به همین دلیل رعایت نکاتی که فهمیدن چگونگی کارکرد برنامه را برای توسعه‌دهندگان احتمالی ساده‌تر می‌کند ضروری است. این مقاله به بررسی پادالگوهای مرتبط با نام‌گذاری توابع و ارائه‌ راه‌حل برای رفع خودکار آن‌ها می‌پردازد. به پادالگوهایی که مربوط به نام‌گذاری توابع، متغیرها و سایر اعضا در کدِ زبان اصلی نرم‌افزار و همچنین مستندات آن هستند پادالگوهای زبان‌شناختی گفته می‌شود. در این مقاله روشی برای تشخیص و رفع خودکار پادالگوهای زبان‌شناختی به کمک درخت نحو انتزاعی ارائه می‌شود. سپس روش ارائه‌ شده بر روی کدِ زبان اصلی چهار نرم‌افزار متن‌باز که در مجموع بیش از ۱۵۰۰۰۰ خط کد دارند، آزمایش می‌شود. در نتیجه این آزمایش‌ها ۵۱ پادالگو به درستی شناسایی و اصلاح می‌شوند. اصلاح شدن به گونه‌ای است که حدود ۵۰ خط کد به مجموعه کد‌ها اضافه می‌کند. مزیت این پژوهش نسبت به پژوهش‌های مشابه، ارائه‌ روشی برای رفع پادالگوها و اعمال تغییرات در کدِ زبان اصلی است. زیرا بسیاری از پژوهش‌ها تنها به تشخیص پادالگوهای زبان‌شناختی اکتفا کرده‌اند. همچنین، تاثیری که این بازسازی بر روی تعداد خطوط کدِ زبان اصلی می‌گذارد نیز بررسی شده است.
کلیدواژه‌ها
موضوعات

[1] V. Arnaoudova, "A New Family of Software Anti-Patterns: Linguistic Anti-Patterns," in Proceedings of the 2013 17th European Conference on Software Maintenance and Reengineering, Genova, Italy, March 5-8, 2013, pp. 187-196.
[2] M. Wahler and U. Drofenik, "Improving Code Maintainability: A Case Study on," in Proceedings of the 2016 IEEE International Conference on Software Maintenance and Evolution (ICSME), Raleigh, NC, USA, October 2-7, 2016, pp. 493-501.
[3] F. Arcelli Fontana, "Metrics and Antipatterns for Software Quality Evaluation," in Proceedings of the 2011 IEEE 34th Software Engineering Workshop, Milano, Italy, June 20-21, 2011, pp. 48-56.
[4] A. Stoianov, "Detecting Patterns and Antipatterns in Software using Prolog Rules," in Proceedings of the IEEE 2010 International Joint Conference on Computational Cybernetics and Technical Informatics, Timisoara, Romania, May 27-29, 2010, pp. 253-258.
[5] C. U. Smith, "Software Performance AntiPatterns," in Proceedings of the 27th International Computer Measurement Group Conference, Boulder, Colorado, December 2-7, 2001, pp. 797-806.
[6] Z. Kermansaravi, "Linguistic Anti-Patterns: Impact Analysis on Code Quality," arXiv preprint arXiv:2104.00058v1. March 31, 2019.
[7] "Abstract syntax tree," Wikipedia, URL: https://en.wikipedia.org/wiki/Abstract_syntax_tree/, Access Date: 4 Feb 2022.
[8] D. v. Leewen, "Comprehensible Method Names: Focusing on the Nouns," University of Amsterdam, 2012.
[9] D. Steidl and B. Hummel, "Quality analysis of source code comments," in Proceedings of the 2013 21st International Conference on Program Comprehension (ICPC), San Fransisco, CA, USA, May 20-21, 2013. pp. 83-92.
[10] D. Souza, "A Study of the Documentation Essentials to Software Maintenance," in Proceedings of the 23rd annual International Conference on Design of Communication: Documenting & Designing for Pervasive Information, New York, NY, USA, September 21-23, 2005, pp. 68-75.
[11] C. S. Hartzman and C. F. Austin, "Maintenance Productivity: Observations Based on an Experience in a Large System Environment vol. 1," IBM Press, Oct, 1993.
[12] A. D. Lucia and M. D. Penta, "Improving Source Code Lexicon via Traceability and Information Retrieval," IEEE Transactions on Software Engineering, vol. 37, no. 2, pp. 205-227, 2011.
[13] S. Harry, "Object-oriented COBOL recycling," in Proceedings of the WCRE '96: 3rd Working Conference on Reverse Engineering, DC, United States, November 8-10, 1996, pp. 169-178.
[14] S. Haiduc and A. Marcus, "On the Use of Domain Terms in Source Code," in Proceedings of the 2008 16th IEEE International Conference on Program Comprehension, Amsterdam, Netherlands, July 10-13, 2008, pp. 113-122.
[15] D. Lawrie, "Quantifying identifier quality: an analysis of trends," Kluwer Academic Publishers, vol. 12, no. 4, pp. 359-388, 2007.
[16] S. Butler, M. ‌Wermelinger, Y. Yu and H. Sharp, "Relating Identifier Naming Flaws and Code Quality: An Empirical Study," in Proceedings of the 2009 16th Working Conference on Reverse Engineering, Lille, France, October 13-16, 2009, pp. 31-35.
[17] V. Arnaoudova, "Towards Improving the Code Lexicon and its Consistency (PhD thesis)," École Polytechnique de Montréal ,2014.
[18] L. Kui, "Learning to Spot and Refactor Inconsistent Method Names," in Proceedings of 2019 IEEE/ACM 41st International Conference on Software Engineering (ICSE), Montreal, Canada, May 25-31, 2019, pp. 1-12.
[19] V. Arnaoudova, "Linguistic Antipatterns: What They Are and How Developers Perceive Them," Empirical Software Engineering, vol. 21, no. 1, pp. 104-158, 2016.
[20] "Text segmentation," Wikipedia, URL: https://en.wikipedia.org/wiki/Text_segmentation/, Access Date: 5 Feb 2022.
[21] E. Aghajani, C. Nagy, G. Bavota, M. Lanza, “A large-scale empirical study on linguistic antipatterns affecting APIs,” In 2018 IEEE International conference on software maintenance and evolution (ICSME) IEEE, Madrid, Spain, 2018, pp. 25-35.