Detecting Java Programming Language Smell Code with a Long
Parameter List
Fajar Ratnawati and Jaroji
Politeknik Negeri Bengkalis, Bengkalis, Riau, Indonesia
Keywords: Smell Code, Java, Long Parameter List.
Abstract: This research resulted in the evaluation of the smell code (wrong program code) in the Java programming
language. The main objective to be achieved in this study is to detect the smell code (wrong program code)
so that the quality level of the code can be seen. The smell code that will be detected in this study is a long
parameter list. To support the research process, the evaluation phase of a Java-based application case study
was taken from the PMD static code analyzer as a code inspection sample for smell code detection and
software metric calculations. The results obtained are code detection based on smell code rulesets, namely
warning errors that have been determined with a number of parameters greater than four.
1 INTRODUCTION
The complexity of software systems is currently
increasing at such a rapid pace that software
companies must constantly update the source code
that has been created (D. Di Nucci et al, 2018). These
ongoing changes frequently take place under duress
and in a short period of time. As a result, developers
abandon sound programming practices and
principles. They want to provide the best product
possible but are unable to do so because they are
working in the shortest amount of time possible (F.
Shull et al, 2013). In other words, the source code's
quality is not optimal or good because of an error or
problem in the source code.
Java is a popular programming language because
the range of applications that can be made using this
language is very wide, from computers to
smartphones (Mardison, 2017). The Java
programming language is known as OOP-Object
Oriented Programming. Java was first developed by
Sun Microsystems, which was started by James
Gosling and released in 1995. Currently, Sun
Microsystems has been acquired by Oracle
Corporation. Java is Write Once, Run Anywhere (a
program that is written once and can run on multiple
platforms). Just like programming in general, the Java
programming language can work using a database.
Almost all of the Study Programs in the Informatics
Engineering Department use the Java programming
language for the practicum learning process. Hundreds
of Java program codes, the result of student
assignments, are still manually checked. Sometimes,
only checked by the output generated from the code
without regard to the quality of the program.
Smell code is a term used to indicate that there
may be a problem in a program's code. (Slinger and
Stevan, 2005). A smell in code indicates that
something is wrong, or that it should not be in the
code. Smell code is a problem caused by a design flaw
in a piece of software. This poor design can lower the
quality of the compiled software. Smell code must be
reduced by detecting its presence in program code
and repairing it as needed. Humans can detect smell
codes manually, or a system can do it automatically.
However, manual detection will take a long time,
especially if hundreds of program codes are to be
detected. As a result, we require a code smell detector
device that can be used automatically to detect
hundreds of program codes in a relatively short period
of time.
The long parameter list is one of the methods in
the smell code. There is no specific rule on how many
parameters to use in one method. Usually, more than
three or four is considered too many. Long parameters
that are easy to recognize include:
1. It is hard to use a method call or to get the
parameters in the correct order.
2. It is hard to read and interpret what a method call
does.
3. A method call has boolean parameters.