Tool Refactoring Otomatis untuk Menangani Lazy Class Code Smell dengan Pendekatan Software Metrics

Penulis

Umi Sa'adah, Desy Intan Permatasari, Fadilah Fahrul Hardiansyah, Andhik Ampuh Yunanto, Jauari Akhmad Nur Hasim, Irma Wulandari, Muhammad Reza Pahlevi, Dufan Quraish Shihab

Abstrak

Keberadaan lazy class sebagai code smell dapat meningkatkan jumlah class yang tidak begitu perlu pada perangkat lunak, sehingga meningkatkan biaya pemeliharaan dari segi waktu dan usaha. Ancaman tersebut dapat diatasi dengan restrukturisasi internal atau refactoring perangkat lunak. Namun, akibat keterbatasan tool, mengharuskan proses refactoring dilakukan secara manual, sehingga membutuhkan waktu dan biaya pemeliharaan yang tinggi. Penelitian ini mengajukan sebuah tool yang dapat mendeteksi dan me-refactoring lazy class secara otomatis. Penelitian yang diajukan ini bertujuan untuk menghindari refactoring lazy class secara manual. Input dari tool merupakan lokasi sebuah projek. Proses dimulai dari mendeteksi file dan class pada projek. Kemudian dilakukan proses deteksi lazy class dengan mengukur karakteristik perangkat lunak atau software metrics. Tahapan terakhir yaitu proses refactoring otomatis, yang dilakukan dengan membuat, me-replace, atau menghapus file, untuk menghasilkan projek yang telah di-refactor. Berdasarkan hasil percobaan, tool yang dikembangkan ini mampu mendeteksi dan me-refactoring lazy class dengan tingkat akurasi sama dengan manual dan proses kecepatannya hanya 5,71 detik. Sehingga hal ini menunjukkan bahwa tool dapat bekerja secara akurat dan lebih cepat dibandingkan dengan cara manual. Serta tool ini diharapkan dapat membantu para pengembang untuk meminimalisir effort dari segi biaya dan waktu dalam melakukan refactoring.

 

Abstract

The existence of lazy classes as code smells can increase the number of unnecessary classes in software, thus increasing maintenance costs in terms of time and effort. These threats can be overcome by internal restructuring or software refactoring. However, due to limited tools, the refactoring process is required to be done manually, which requires time and high maintenance costs. This research proposes a tool that can detect and refactor lazy class automatically. This research is proposed to avoid refactoring lazy class manually. The input of the tool is the location of a project. The process starts with detecting files and classes in the project. Then the lazy class detection process is carried out by measuring the characteristics of the software or software metrics. The final stage is the automatic refactoring process, which is done by creating, replacing, or deleting files, to produce a refactored project. Based on the experimental results, the tool developed is able to detect and refactoring lazy classes with the same accuracy level as manual and the process speed is only 5.71 seconds. So this shows that the tool can work accurately and faster than the manual method. And this tool is expected to help developers to minimize the effort in terms of cost and time in refactoring.


Teks Lengkap:

PDF

Referensi


FOWLER, M., & BECK, K. 1999. Refactoring: Improving the Design of Existing Code. Westford: Addison-Wesley Professional.

FONTANA, A. F., BRAIONEA, P., & ZANONIA, M. 2012. Automatic detection of bad smells in code: An experimental assessment. dalam Journal of Object Technology, Vol. 11, No. 2.

KIM, T. W., KIM. T. G., & SEU, J. H. 2013. Specification and Automated Detection of Code Smells using OCL. dalam International Journal of Software Engineering and Its Applications, Vol. 7, No. 4, pp. 35-44.

ARISTYAGAMA, Y. 2016. Framework Deteksi Bad Smell Code Semi Otomatis untuk Pemrograman Tim. Institut Teknologi Bandung, Bandung.

BLONSKI, H., PADILHA, J., BARBOSA, M., SANTANA, D., & FIGUEIREDO, E., 2013. ConcernMeBS: Metrics-based Detection of Code Smells. dalam Congresso Brasileiro de Software (CBSoft), Brasília.

IBRAHIM, R., AHMED, M., NAYAK, R., & JAMEL, S. 2020. Reducing redundancy of test cases generation using code smell detection and refactoring, dalam Journal of King Saud University - Computer and Information Sciences, vol. 32, no. 3, pp. 367-374.

DONG, K. K. 2017. Finding Bad Code Smells with Neural Network Models. dalam International Journal of Electrical and Computer Engineering (IJECE).

PUTRA, F. Z. P., PERMATASARI, D. I., SA'ADAH, U., HARDIANSYAH, F. F., & HASIM, J. A. N., 2019. Rancang Bangun Pustaka untuk Deteksi Otomatis Long Method Code Smell. dalam The 11th National Conference on Information Technology and Electrical Engineering, Yogyakarta.

VALE, G. & FIGUEIREDO, E. 2015. A Method to Derive Metric Thresholds for Software Product Lines. dalam 2015 29th Brazilian Symposium on Software Engineering (SBES).

MANTYLA, M. V., VANHANEN, J., & LASSENIUS, C. 2004. Bad Smells - Humans as Code Critics. dalam 20th IEEE International Conference on Software Maintenance (ICSM’04). Chicago.

KOLB, R., MUTHIG, D., PATZKE, T., & YAMAUCHI, K. 2005. A Case Study in Refactoring A Legacy Component For Reuse In A Product Line. dalam Proceedings of International Conference on Software Maintenance. Budapest.

RATZINGER, J., FISCHER, M., & GALL, H. 2005. Improving Evolvability Through Refactoring. dalam Proceedings of the international workshop on Mining software repositories, pp. 1-5.

MOSER, R., SILITTI, A., & ABRAHAMSSON, P. 2006. Does Refactoring Improve Reusability? dalam Proceedings of International Conference on Reuse of Off-the-Shelf Components, pp. 287-297.

DANPHITSANUPHAN, P., & SUWANTADA, T. 2012. Code Smell Detecting Tool and Code Smell-Structure Bug Relationship. dalam Spring Congress on Engineering and Technology 2012, pp. 1-5.

SZOKE, G., NAGY, C., FULOP, L. J., FERENC, R., & GYIMOTHY, T. 2015. FaultBuster: An Automatic Code Smell. dalam 2015 IEEE 15th International Working Conference on Source Code Analysis and Manipulation (SCAM), Bremen.

PADILHA, J., PEREIRA, P., FIGUEIREDO, E., ALMEIDA, J., GARCIA, A., & SANT’ ANNA, C. 2014. On the Effectiveness of Concern Metrics to Detect Code Smells: An Empirical Study. dalam International Conference on Advanced Information Systems Engineering (CAiSE 2014), Thessaloniki.

PALOMBA, F. 2015. Textual Analysis for Code Smell Detection. dalam IEEE/ACM 37th IEEE International Conference on Software Engineering.

Code Smell. Diakses dari http://en.wikipedia.org/wiki/Code_smell. Tanggal 3 September 2018.

Dispensables, Refactoring Guru. Diakses dari

https://refactoring.guru/refactoring/smells/dispensables. Tanggal 23 Januari 2019.

What Are Software Metrics and How Can You Track Them? Stringfellow, A. Diakses dari

https://dzone.com/articles/what-are-software-metrics-and-how-can-you-track-th. Tanggal 27 Juni 2019.




DOI: http://dx.doi.org/10.25126/jtiik.2022934646