Hybrid Technique for Complexity Analysis for Java Code

Hybrid Technique for Complexity Analysis for Java Code

Mohammad Subhi Al-Batah (Faculty of Science and Information Technology, Jadara University, Irbid, Jordan), Nouh Alhindawi (Faculty of Science and Information Technology, Jadara University, Irbid, Jordan), Rami Malkawi (Department of Computer Information Systems, Yarmouk University, Jordan) and Ahmad Al Zuraiqi (Jadara University, Irbid, Jordan)
Copyright: © 2019 |Pages: 16
DOI: 10.4018/IJSI.2019070107


Software complexity can be defined as the degree of difficulty in analysis, testing, design and implementation of software. Typically, reducing model complexity has had a significant impact on maintenance activities. A lot of metrics have been used to measure the complexity of source code such as Halstead, McCabe Cyclomatic, Lines of Code, and Maintainability Index, etc. This article proposed a hybrid module which consists of two theories which are Halstead and McCabe, both theories will be used to analyze a code written in Java. The module provides a mechanism to better evaluate the proficiency level of programmers, and also provides a tool which enables the managers to evaluate the programming levels and their enhancements over time. This will be known by discovering the various differences between levels of complexity in the code. If the program complexity level is low, then of the programmer professionalism level is high, on the other hand, if the program complexity level is high, then the programmer professionalism level is almost low. The results of the conducted experiments show that the proposed approach give very high and accurate evaluation for the undertaken systems.
Article Preview

1. Introduction

Java language is considered as one of the languages that has various advantages, these advantages include s its simplicity, safety, strength, impact, high level object-oriented ability, and many other advantages (Arnold, Gosling, Holmes & Holmes, 2000). Complexity can here be defined as, the relationship between the internal parts of the program and how these parts can be interacted with each other, some of these parts will be connected to other parts of the program to make the program more complex and difficult to be analyzed or maintained. However, if these parts are less cohesive then the program will be less complex, in this case, the analysis would be easier to be analyzed and maintained (Sanchez & Lucas, 2002). The benefits of complexity measurement can be summarized as follows:

  • 1.

    Complexity analysis of code can even be estimated from a design (whenever the design is easy and simple then the code will be less complex, in contrast, if the design is more complex and unclear, then the program will be more complex).

  • 2.

    The ability to distinguish between the simple and more complex program (allow the programmers to write a program in a way that has the following features: high quality, easy to understand, has few mistakes, easy to use and re-use, easy to maintain, easy to test, saves time and lower cost).

  • 3.

    Good Complexity Measure provides continuous feedback (allowing us to follow the program continuously and to avoid most of the expected mistakes or problems).

The main reason for analyzing the complexity of the code is to measure the complexity ratio of the code, it is possible that can be helpful for reducing the complexity, for this reason the following case should be discussed: 1) A simple module without much risk, 2) A more complex module with moderate risk, 3) A complex module of high risk, and 4) An un-testable program of very high risk. Table (1) shows the difference between good complexity and bad complexity.

Table 1.
Level of complexity by McCabe measure
ComplexityRisk Evaluation
1-10A simple module without much risk
11-20A more complex module with moderate risk
21-50A complex module of high risk
51 or moreAn untestable program of very high risk

Categorizing any source code complexity into good or bad will be helpful for code maintenance and evolution. Typically, the source code with good complexity is more maintainable, testable, understandable, and have less errors. On the other hand, any source code with bad complexity will be complex to be maintained, tested, understood by developers, and it will have a lot of errors.

Shrivastava (2008) presented a measurement to provide a single ordinal number to be used to compare the program’s complexity with other programs. This measurement used McCabe Complexity measures to analyze the system and find the complexity of the program, as follows:

CC=E – N+ PWhereCC = Cyclomatic ComplexityE = Number of edges of the graphN = Number of nodes of the graph

Complete Article List

Search this Journal:
Open Access Articles: Forthcoming
Volume 8: 4 Issues (2020): 2 Released, 2 Forthcoming
Volume 7: 4 Issues (2019)
Volume 6: 4 Issues (2018)
Volume 5: 4 Issues (2017)
Volume 4: 4 Issues (2016)
Volume 3: 4 Issues (2015)
Volume 2: 4 Issues (2014)
Volume 1: 4 Issues (2013)
View Complete Journal Contents Listing