and could be replaced, for example, with an enum.
The joda-time relies more on static final variables than
the other two projects. These variables are members
in multiple classes with the same name, making it har-
der to understand the code. A generalized solution
could be considered instead of the scattered constant
usage. In log4j a typical example for type codes can
be found in the PatternParser class, which also ap-
pears in both intersections.
Though no hidden dependency check was done
to study the seriousness of the possible type codes it
might be rewarding to refactor them for a more object
oriented and readable solution.
6 CONCLUSION
In this paper several variants for the basic Primitive
Enthusiasm metric were introduced and other three
metrics were defined to grasp more aspects of the Pri-
mitive Obsession bad smell. The metrics were imple-
mented in a Java static analyser, evaluated on three
large systems and the results were analysed.
The Primitive Enthusiasm variants can find met-
hods that use more primitive types in their parameter
lists as the average. It is not just a readability issue but
can be a sign for other bloater type smells as well. The
SFP-SCU metric is useful for typed code detection. In
the future the authors would like to consider if a static
final variable can be seen outside its class or not by gi-
ving the usages outside its class or package a different
weight than the inner usages. Additionally involving
other conditional statements in the calculation besi-
des switch-cases can be another improvement. The
MPC metric reports classes that have repetitive, the-
refore possibly smelly method signatures. The metric
could be refined with ordinal information among the
parameter clones.
The findings showed that the new metrics can
highlight many smelly and hardly readable code seg-
ments. In the future we would like to continue the
study of these metrics and their combinations. The
inclusion of enum constants in the PrimitiveTypes set
could be an interesting experiment. Creating a Primi-
tive Obsession benchmark is also a goal to provide a
more objective comparison of the metrics.
ACKNOWLEDGEMENTS
This research was supported by the EU-funded Hun-
garian national grant GINOP-2.3.2-15-2016-00037
titled “Internet of Living Things” and by the pro-
ject ”Integrated program for training new generation
of scientists in the fields of computer science”, no
EFOP-3.6.3-VEKOP-16-2017-0002. The project has
been supported by the European Union and co-funded
by the European Social Fund.
REFERENCES
Fontana, F. A., Mariani, E., Mornioli, A., Sormani, R., and
Tonello, A. (2011). An experience report on using
code smells detection tools. In 2011 IEEE Fourth In-
ternational Conference on Software Testing, Verifica-
tion and Validation Workshops, pages 450–457.
Fowler, M. (1999). Refactoring: Improving the Design of
Existing Code. Addison-Wesley, Boston, MA, USA.
G
´
al, P. and Peng
˝
o, E. (2018). Primitive enthusiasm: A road
to primitive obsession. In The 11th Conference of PhD
Students in Computer Science.
Gamma, E., Helm, R., Johnson, R., and Vlissides, J.
(1995). Design Patterns: Elements of Reusable
Object-oriented Software. Addison-Wesley Longman
Publishing Co., Inc., Boston, MA, USA.
Gupta, A., Suri, B., and Misra, S. (2017). A systematic lite-
rature review: Code bad smells in java source code. In
Computational Science and Its Applications – ICCSA
2017, pages 665–682, Cham. Springer International
Publishing.
M
¨
antyl
¨
a, M. V., Vanhanen, J., and Lassenius, C. (2003). A
taxonomy and an initial empirical study of bad smells
in code. In Proceedings of the International Con-
ference on Software Maintenance, ICSM ’03, pages
381–, Washington, DC, USA. IEEE Computer So-
ciety.
M
¨
antyl
¨
a, M. V., Vanhanen, J., and Lassenius, C. (2004).
Bad smells - humans as code critics. In Proceedings
of the 20th IEEE International Conference on Soft-
ware Maintenance, ICSM ’04, pages 399–408, Wa-
shington, DC, USA. IEEE Computer Society.
Moonen, L. and Yamashita, A. (2012). Do code smells re-
flect important maintainability aspects? In Procee-
dings of the 2012 IEEE International Conference on
Software Maintenance (ICSM), ICSM ’12, pages 306–
315, Washington, DC, USA. IEEE Computer Society.
Roperia, N. (2009). Jsmell: A bad smell detection tool for
java systems. Master’s thesis, Maharishi Dayanand
University.
Yamashita, A. and Moonen, L. (2013). To what extent can
maintenance problems be predicted by code smell de-
tection? an empirical study. Information and Soft-
ware Technology, 55(12):2223 – 2242.
Yu, Z. and Rajlich, V. (2001). Hidden dependencies in
program comprehension and change propagation. In
Proceedings 9th International Workshop on Program
Comprehension. IWPC 2001, pages 293–299.
Zhang, M., Hall, T., and Baddoo, N. (2011). Code bad
smells: A review of current knowledge. Journal of
Software Maintenance and Evolution, 23(3):179–202.
ICSOFT 2018 - 13th International Conference on Software Technologies
396