2017 8th International Conference on Information Technology (ICIT)
Evaluating Maintainability of Android Applications Ahmad A. Saifan
Areej Al-Rabadi
Software Engineering Department Faculty of IT, Yarmouk University Irbid, Jordan
[email protected]
Computer Science Department Faculty of IT, Yarmouk University Irbid, Jordan
[email protected]
Abstract—Android applications are considered the most popular and desirable applications due to their friendly interface, various categories and available options, and supporting most of the available hardware in the market. Complexity to understand, design, develop, implement, and test android applications have been raised. Maintainability is a very important quality attribute that we should consider it seriously. However, it is one of the most difficult and costly attributes that can be achieved. The software metrics are used to predict and estimate the software maintainability value. There are several metrics and formulas that are used to measure and estimate the maintainability value. These metrics and formulas are derived from the different usages of the maintainability. This paper focus on analyzing and measuring the maintainability of Android mobile applications using Object Oriented metrics and Android Metrics. The purpose of this paper is to assess the impact all of these metrics on the maintainability of Android applications and choose the metrics that has the highest impact. Keywords—Maintaniabilty; analysis; Software metrics
I.
Android
application;Regression
INTRODUCTION
During the last years, using smartphones specially that running Android Operating System (OS) became more popular. Thus, the development of Android application increased. In 2016, Google play store reached more than 65 billion application downloads. In October 2016 [11] the number of applications on Google play store was over 2.4 million applications, 13% of them classified as low quality application [12]. Due to sharp increasing of user requirements, popularity of Android applications, big competitive challenges between developers and rapid technology evolution, these have led developers to develop applications rapidly, which effects the quality of the produced applications through adopting bad design. Because of the fast growth and rapid updates that happened frequently for the android applications, it is important for mobile software developers to keep their applications maintainable. Otherwise, if they fail or are unable to keep their applications maintainable it will be more difficult for them to keep up with the rapid changes and ensure their applications remain relevant in the fast changing mobile application market[8]. The maintainability is a characteristic of design and installation which determines the probability that a failed equipment, machine, or system can be restored to its normal
978-1-5090-6332-1/17/$31.00 ©2017 IEEE
operable state within a given timeframe. Now with the popularity of the smartphones that is used by different people in different ages, the popularity of the android operating system is increased rapidly, so that the maintainability in the android world is very important; it can decide if the application can be used for a long time because any application can fail in the future or the customer's needs can be changed, so that any application must be repairable and maintainable to accept any changes that can happen in the future, in another meaning it can increase the age of the software and keep it up to date. But there are several of the problems and constraints that can face any programmer, one of these constraints the cost, maintainer training, maintenance manuals, such that it needs an experience developer who knows how to build a maintainable software, although the maintainability attribute is very expensive Some metrics are used to measure and analyze the maintainability based on a given source code of an Android application. A set of OO and a set of Android metrics that are relevant to maintainability are provided in section II. The main purpose of this paper to see whether the Android metrics have an impact on the maintainability or not. Then, write a new formula to analyze the maintainability of Android applications. This paper is structured as follows: Section II provides the necessary Related work: it briefly describes the maintainability in Object Oriented programming languages and Android operating systems. The detailed methodology approach is presented in Section III. Section IV conclude the paper. II.
LITERATURE REVIEW
A. Maintainability in Object Oriented programing language Many literatures compute maintainability based on MI index, Similar to [13,22] we examine three open source software, Anita Ganpati examine the maintainability of the four OSS through a formula based on average Halstead volume, average cyclomatic complexity per module, average Line of code per module. Antina prove that maintainability value differs from one application to another; Mozilla Firefox gains the highest maintainability value whereas Appache gain the lowest value. The author conclude that the Mozilla more maintainable than Apache.
2017 8th International Conference on Information Technology (ICIT) Nahlah Najm [14] suggest a new equation to calculate the maintainability index depending on the factored formula (MI);MI consist of LOC, cyclomatic complexity, halstead volume, suggested formula resulted from calculation on the old formula, it is depends on LOC only, which produce results close to the old MI formula with less effort and time to calculate. Unlike [15,16] we examine the maintainability depending on its four sub characteristics formula. Many research assesses maintainability using various models and techniques. Similar to [15] we depend on C&K metrics to assess maintainability. The researchers reviewed OO metrics to construct a model that predicts OSS maintainability, they made a comparison between metrics applicable on OSS versus those applicable to OO and they find many OO metrics applicable to OSS but few (like LOD and LCN) cannot be applicable to OSS. They try to find a relationship between maintainability and coupling, cohesion, complexity. They found that maintainability has an inverse relationship with complexity which increase according to increase in (LOC,WMC,NAM,DIT, CBO, REF, LCOM, CC, EHF, NCB). Unlike [4] we focus on the main characteristics of maintainability; Analyzability , Changeability ,Stability, and Testability. D. Crabtree et.al [1] defined the maintainability as a measure that is used to determine how easy it is to maintain a system after its failure. They talked about the cost of the maintainability and how prohibitive it is. The maintainability is one of the software requirements that must be imposed on any software products. They saw that the cost factor is the most important one to measure the maintainability because it reflects features of the software process such as personal attributes and project attributes size. They used a formula to estimate the maintainability depending on the cost. H. Paul Barringer, P.E. Barringer & Associates [2] presented that maintainability can be measure by the time; the period needs to maintain (modify ) the code, in another meaning and how it is easy and how is faster to maintain the code compared to a datum, the datum means or include all the necessary actions that required to retain an item in. The maintainability characteristics can be measured by the time that we need to maintain the code and by equipment design.
reduce the cost of the maintainability that comes after the delivery, so he agreed with Rimmi Saini presented in [3], and with what I said before about this point the maintainability that come after the delivery is very costly. He depended on the flexibility and extendibility which are sub-characteristics of maintainability as criteria to evaluate a maintainability model of a class diagram and develop the Maintainability Estimation Tool (MET) for a maintainability estimation of class diagram. This tool helps a software designer for improves the maintainability of class diagram in the design phase and help reduce the increasing high cost of software maintenance phase. Abdulrhman Albeladi et. al. [6], The maintainability factor defines if the software can be modified and maintained. These Modifications may be corrections, enhancement, or just a change in the software to meet the changes in the environment, in the requirements or the functional specifications. There are four factors that affect the maintainability of software which are: (1) analyzability which measure the ability to define fault or failure within the software, (2) changeability that is the capability to modify software products, (3) stability that refers to the capability to avoid unexpected effects form changing software product, and (4) testability which is the capability to test and validate the modified software product [16]. Fig. 1 shows the metrics that each factor depends on. The maintainability
Analyzability Cl_wmc In_bases Cu_cdused Cl_cmof
Testability Cl_wmc Cl_fun Cu_cdused
Changeability Cl_stat Cl_data Cl_fun
Stability Cl_data_publ Cu_cdusers In_noc Cl_fun_publ
Fig. 1. The maintainability factors and its metrics
The merit for maintainability considered by the mean time to repair (MTTP) it means how long the maintainability functions will take to do the required modification (how fast the system can be repaired), and a limit for maximum repair time. Qualitatively refers to how easy it is to restore the hardware and software to do its functions, it has probabilities and it is measured based on the total down time for maintenance like active repair time. Alisara Hincheeranan and Wanchai Rivepiboon [5], the ease with which a software system or component can be modified to correct faults, improve performance or other attributes, or adapt to a changed environment, and the maintainability that come in the design phase may help a software designer to
The formula to compute the values of the maintainability as presented by [6] is:
Maintainability = Analyzability + Changeability + Stability + Testability … (1), where : Analyzability= cl_wmc + cl_comf + in_bases + cu_cdused … (2) Changeability= cl_stat + cl_func + cl_data …(3) Stability=cl_data_publ+cu_cdusers+ in_noc + cl_func_publ … (4) Testability= cl_wmc + cl_func + cu_cdused… (5)
2017 8th International Conference on Information Technology (ICIT) Table I describes these metrics and the attributes that can be affected by these metrics. TABLE I. The metric Cl_wmc In_bases Cu_cdused Cl_cmof Cl_stat Cl_data Cl_fun Cl_fun_publ Cu_cdusers In_noc Cl_data_publ
The ratio between the number of lines of comments and the total number of lines in the code. Number of the executable statements. The total number of the attributes in the class. The total number of the functions in the class. The total number of the public functions in the class. The number of classes which directly use this class. The number of children of this class. The total number of the public attributes in the class.
Its affect Complexity, understandability and cohesion Complexity and understandability. Coupling, the complexity and reuse of methods. The size of the class
Decrease the understandability cl-cdused, cl-cdusers in-noc and in_bases are not accepted
High coupling and Low cohesion
Decrease the changeability and the analyzability
Decrease the stability
Fig. 2. The relationship between metrics and quality attributes
The size of the class TABLE III. Complexity, and the size of the class. Complexity and cohesion. Coupling and the polymorphism. Coupling, changeability and reuse of methods. Reuse of methods and testing Encapsulation (information hiding )
As presented in [1] Table II represents the range of acceptable values for all metrics presented in Table I. Table II is used to analyze the results.
The metric Cl_wmc Cl_fun Cu_cdused Cl_stat Cl_data Cl_data_publ Cu_cdusers In_noc Cl_fun_publ In_bases Cl_cmof
Increase the testability Effort
Increase the complexity
THE METRICS DEFINITION
Definition Weighted method per class, measures the complexity of the method. Number of classes from which the class inherits directly or not. The number of directly classes used by this class.
TABLE II.
cl-wmc, cl-fun and in_bases are not accepted
DEFINIFITIONS OF MAINTAINABILITY AND ITS FACTORS
The Author D. Crabtree H. Paul Barringer
Rikard Land Mälardalen
Rimmi Saini
THE METRICS RANGE Range (min-max) 0-11 0-9 0-6 0-7 0-25 0-7 0-3 0-5 0-7 0-4 0-100
Fig. 2 shows the relationship between the metrics and the quality attributes presented in [6]. We conclude that every author defined the maintainability attribute and the metrics that have a direct effect on it based on his/her opinion. Because of these reasons the maintainability is estimated in several ways and using several metrics to predict its value. Table III shows how each author defines maintainability and the main factors that can impact on the its value.
Alisara Hincheeranan
Abdulrhman Albeladi
Definition determine how easy it is to maintain a system after its failure how it is easy and how is faster to maintain the code compared to a datum, the datum means or include all the necessary actions that required to restore the item or to retain an item in as how easy it is to modify software or component to correct faults, to improve performance or other attributes, or just adapt to any change that occur in the environment how it is easy to modify the software component to correct faults, improve performance or other characteristics, or adapt to a changed environment "the ease with which a software system or component can be modified to correct faults, improve performance or other attributes, or adapt to a changed environment" The maintainability factor defines if the software can be modified and maintained to correct faults, enhance operation, or meet the requirements’ changes
Main factor Cost Time
The maintainability attributes
Testability, changeability, analyzability and the stability flexibility and extendibility
B. Maintainability in The Android Operating Systems Mobile applications are mostly developed using Object – Oriented languages such as C#, Java,…etc. So that many researches considered Object Oriented metrics (traditional metrics presented in Table І) to be an efficient, quality indicator in measuring software quality attributes such as understandability, usability, reliability and maintainability. Such of these researches presented in [17, 18,19]. Wang in his thesis [19] measured the maintainability of Android applications by using OO metrics like number of methods in class, number of subclasses, lines of code, cyclomatic complexity,... etc. He developed a plugin for the Android Studio Developers that is used to analyze Android application source codes. Merve Vildan Şimşek [9] presented that the Android applications should have its own metrics to order to analyze it
2017 8th International Conference on Information Technology (ICIT) because Android applications have special features that does not exist in OO. Table IV shows the android metrics that can be used to estimate the maintainability. TABLE IV. The metric NOAC (android metric ) NOS (android metric ) NOCP(android metric) NOP (android metric) COP (OO metric ) DIT (OO metric) NOC (OO metric) NOM (OO metric ) TSDK (android metric ) MSDK (android metric ) NOAT (OO metric) NOC (OO metric) COH (OO metric) CC (OO metric) NOD (android metric ) NOBR (android metric)
ANDROID METRICS WITH OO METRICS The definition Number of classes that extend Activity in a source code. Number of classes that extend Service in a source code. Number of classes that extend Contents Provider in a source code Number of requested permissions that the application should have to operate correctly () Instability, the ratio between of efferent coupling to total coupling Depth of inheritance tree Number of children Total number of the methods Target SDK Version, this is an integer which indicates to the target API level required the application to run min SDK Version, this is an integer which indicates to the minimum API level required the application to run Total number of the attributes Total number of classes Lake of cohesion, how the methods within the same class are strongly related Cyclomtic complexity, the number of independent paths in the source code Number of classes that extend Dialog in a source code. Number of classes that extend Broadcast Receivers in a source code.
Some of these metrics can affect positively on the maintainability (DIT, NOC, NOAC, NOS, NOT, NOCP, NOS and NOTD) and other metrics affect negatively (COP and NOM ) Tobias Ammann [7] presented that there is no single metric that can be used as a basic metric to predict the application maintainability. Some of the metrics that can be used : 1. Source Lines of Code(SLOC): this metric count the all statements that exist in the source code. There are two kinds of the counting methods: physical counting and logical counting. 2. Cyclomatic Complexity(CC): it measures the control flow in a program (unit or module). This metric can be used by the developer to determine how to modularize a software system so the resulting modules can be testable and maintainable. 3. Information Flow(IF): the original formula is The Henry and Kafura metric, this metric measure the complexity of the information that enters and flow out of a module or the component, (fan-in and the fan-out) of the component. 4. Depth of Inheritance Tree (DIT): depth of Inheritance Tree is an object oriented metric that measures the maximum length from the node to the root of the tree for a class.
5.
Coupling Between Object Classes(CBO): this metric counts the number of connections to other classes from a particular class (number of connections between the classes). An object is coupled to another object if the object depends on another object to be executed.
Daniël Verloop [8], presented that the code smell can play an important role in the android application maintainability. Code smells are patterns in source code that are associated with bad design and bad programming practices. It points to areas in an application that could benefit from altering or refactoring the existing body of code or its internal structure without changing its external behavior so that refactoring helps to improve the maintainability of an application. Using tools to find code smells and refactor the code will help improve the maintainability of applications. Geoffrey Hecht et. al. [10] used several metrics with the OO metrics. Table V explains the android metrics that are used. TABLE V. The metric Number of activities Number Of BroadcastReceivers Number Of ContentProviders Number Of Services IsActivity IsApplication IsBroadcastReceiver IsContentProvider IsService
ANDROID METRICS Where it can be used Application Application Application Application Class Class Class Class Class
In this paper, the two types of metrics OO and Android metrics have been used in order to build a new formula that can be used to analyze the maintainability of Android applications. The formula presented by Abdulrhman Albeladi [6] has been used. Moreover, some other metrics that have presented in by Merve Vildan Şimşek [9] are also used in this experiment. III.
THE METHODOLOGY
Our methodology approach in analyzing the maintainability of Android applications consists of the following steps: 1. 2. 3. 4.
Select the Android application to be used Build the data sets from the system under test by generating all the software metrics (OO and Android metrics). Use the regression analysis to build the new formula for the maintainability quality attribute Analyze the results.
A. Select the Android application to be used In our experiment different applications with different sizes have been discussed. The first application is called openklyph, it is a free, community-driven continuation of the Klyph Facebook client for Android. The second application is called Anki-Android-develop, it is a flashcard application which is fully compatible with the desktop software Anki and
2017 8th International Conference on Information Technology (ICIT) the third application is called Facebook SDK for Android This open-source library allows you to integrate Facebook into your Android app. Table VI shows some of the properties for these applications. TABLE VI.
THE APPLICATIONS
The Applications
#of packages
#of classes
App 1
92
1012
Total lines of code 143284
App 2 App 3
44 14
159 107
93314 27281
B. Build the data set On this approach we used the OO and Android metrics to build our data set presented in Table I and Table IV respectively. In this paper the Android Studio is used to measure the all the maintainability metrics. Android Studio is the official Integrated Development Environment (IDE) for Android app development, based on IntelliJIDEA. Moreover, Android studio is a tool used to develop Android Applications using Java Code. The metrics in android studio cannot use it without having to download a plugin called metricsreloaded [20] which is used to measure the OO and Android application’s metrics and the maintainability index for a given system. Software metrics that allows you to measure maintainability index and another metrics type. Table VII and Table VIII shows our data set. The data set is divided into two tables because of the space issue. TABLE VII. Metrics cl-wmc cl-fun cu-cdused cl-stat cl-data cl-data-pub cu-cdusers In-noc cl-fun-pub In-bases cl-comf
App 1 16.397 8.944 6.811 100700 5.896 0.839 18.137 0.515 5.493 2.343 12.83012
DATA SET-PART 1 App 2 16.544 7.317 13.143 15125 5.811 7.2203 9.714 0.125 4.528 1.857 3.1572
App 3 23.853 9.286 10.841 59622 6.443 0.8383 15.978 0.091 5.088 2.018 20.95
Range (min-max) 0-11 0-9 0-6 0-7 0-25 0-7 0-3 0-5 0-7 0-4 0-100
From the Table VII we can notice the following: • The cl_wmc metric for the three applications exceeded the accepted range. It indicates that the complexity of the projects is very high. This means the three applications are difficult to understand, and the cohesion is very low. • The cl-fun metric for App 3 exceeded the accepted range. It indicates that its methods are complex and has a low cohesion between them. • The cl-data-pub metric for App 2 exceeded the accepted range. It indicates to a low encapsulation • The cu-cdused metric for the three applications exceeded the accepted range. it indicates that we very complex applications with high coupling. • The cl-stat metric is very high it indicates to a big application size, the larger size of the application
•
more complex and error prone that the application is likely to be. The cu-cdusers metric for the three applications exceeded the accepted range. It indicates that a the classes inside these applications are tightly coupled. So the changeability will be hard. TABLE VIII.
Metrics
App 1
DATA SET-PART 2 App 2
App 3
Type
NOAC
1.4359
1.4359
0.125
android
NOS
0.5238
0.5238
0
android
NOCP
0.167
0.167
0
android
NOP
9
9
7
android
COP
0.499
0.499
0.487
OO
TSDK
19
19
19
android android
MSDK
14
14
16
NOC
1012
1012
107
OO
COH
0.233
0.233
2.044
OO
NOD
0
0
0.333
OO
NOBR
0.1429
0.1429
0.4
android
CC
1.969
2.479
2.779
OO
C. Regression Analysis IBM SPSS is used to build the new formula to analyze the maintainability of Android applications based on the data set presented in Tables VII and VIII. "IBM SPSS Statistics are an integrated family of products that helps to address the entire analytical process, from planning and data collection to analysis, reporting and deployment" [21]. We used The Coefficients table presented in Table IX to predict the maintainability index from the software metrics, as well as determine whether a given metric contributes statistically significantly to the model (see Sig. column). The Sig. column indicates the statistical significance of the regression model that was run. The significant value used here is 0.05. We used Table IX to build the maintainability index for the Android applications, see equation (6) presented below.
Maintainability = NOP + IN_NOC + IN_BASES + 2* CL_FUN+CL-CMOF +CL-DATA + CL-STAT + CL-FUN-PUB + CU-CDUSERS + CL-DATA-PUB + 2*CU-CDUSED + 2*CL_WMC …(6)
The definitions of the metrics used in this equation were described in Table I, Table IV. We have to mention here that a high value of maintainability means better maintainability of the software. From this formula we can notice that it is almost the same formula that is used to measure the maintainability for OO applications presented in [6]. As we can notice that NOP metric is the only metric for the Android applications appeared in the formula. This is not because the Android metrics do have any impact in measuring the maintainability for a given
2017 8th International Conference on Information Technology (ICIT) Android source code. But it's because the values of these metrics for the selected applications are very small compared to the values for OO metrics. TABLE IX.
[8]
THE COEFFICIENTS TABLE [9]
[10]
[11]
[12]
[13]
[14]
[15]
[16]
IV.
CONCLUSION
The maintainability can be measured in different ways. The values and the importance of the maintainability metrics depend on the source code. Android applications have special features that distinguished them. To measure the maintainability for those kind of applications we should find a new formula that takes into consideration the metrics that are related. In this paper, we have measured the maintainability for three android projects where the calculation processes were done per class using OO metrics and android metrics. REFERENCES [1]
[2] [3] [4] [5] [6]
[7]
D. Crabtree Science Space Station Program University of Ottawa Canadian Space Agency Ottawa, Ont. K1N 6N5 St Hubert, PQ, J3Y 8Y9 and, R.cheatio M Frapper, S.Matwin, A. mili. Department of Computer University of Ottawa, Ont. K1N 6N5 H. P. Barringer, P.E. Barringer & Associates, Inc. Humble, “ TX Triplex Chapter Of The Vibrations Institute ” R.Mälardalen University Department of Computer Engineering Box 883 SE-721 23 Västerås, Sweden +46 (0)21 10 70 35 R. Saini, S.Dubey, and A. Rana3 in “ analytical study of maintainability models for quality evaluation ”, June 2011 A. Hincheeranan and W. Rivepiboon in “ a maintainability estimation model and tool ” , July 2012. A. Albeladi, R. Abdalkareem, F. Agwaeten, K. Altoum, Y.Bennis, and Z. Nasereldine. “ Toward software measurement and quality analysis of MARF and GIPSY case studies – a Team 13 SOEN6611-S14 project report ”.[online], July 2014. SOEN6611 Summer 2014, http://arxiv.org/abs/1407.0063. T.Ammann Student number 10460411 Bilderdijkkade 42h 1053VE Amsterdam, University of Amsterdam Faculty of Science, in the “ A
[17]
[18]
[19]
[20] [21] [22]
metrics-based comparison of secondary user quality between iOS and Android Master Thesis Software Engineering ”. August 26, 2014. D. Verloop born in Vlaardingen , “ the Netherlands in the Code Smells in the Mobile Applications Domain THESIS submitted in partial fulfillment of the requirements for the degree of MASTER OF SCIENCE in COMPUTER SCIENCE ” , 2013 M. \V. Simsek in “ a software quality model for android applications, a thesis submitted to the graduate school of informatics of the middle east technical university ” ,February 2016 G. Hecht1, O. Benomar, R. Rouvoy1, N. Moha2 and L, Duchien1 in “ Tracking the Software Quality of Android Applications along their Evolution ” , 17 Sep 2015. Statista.com (2016). Cumulative number of apps downloaded from the Google Play as of May 2016 (in billions). https://www.statista.com/statistics/281106/number-of-androidappdownloads-from-google-play. [Online; accessed October-2016]. AppBrain.com (2016). AppBrain stats: Number of android applications. http://www.appbrain.com/stats/number-of-android-apps. [Online; accessed October-2016]. Ganpati, Anita, A. Kalia, and H. Singh. “ A Comparative Study of Maintainability Index of Open Source Software ”.International Journal of Software and Web Sciences 3.2 (2012): 69-73. Najm, N. MAM. "Measuring Maintainability Index of a Software Depending on Line of Code Only IOSR Journal of Computer Engineering (IOSR-JCE),Volume 16, Issue 2, Ver. VII (Mar-Apr. 2014), PP 64-69 Bakar, A. D., Sultan, A. M., Zulzalil, H., & Din, J. (2012). “ Review on'Maintainability' Metrics in Open Source Software ”. International Review on Computers and Software, 7(3). Ghosh, Soumi, and S. Dubey. “Fuzzy Maintainability Model for Object Oriented Software System. ” (2012). Y. Singh, Kaur, and Malhotra. (2010) “ Empirical validation of objectoriented metrics for predicting fault proneness models”. Software quality journal, 18(1):3–35. K. Aggarwal, Y. Singh, A. Kaur, and R. Malhotra. (2009) “ Empirical analysis for investigating the effect of object-oriented metrics on fault proneness” a replicated case study. Software process: Improvement and practice, 14(1):39–62. Wang, “An Android Studio Plugin for Calculating and Measuring Code Complexity Metrics in Android Applications ”, Department of Computer and Information Sciences Towson University Towson, Maryland 2015. Metricreloaded, avialabe at: https://plugins.jetbrains.com/idea/plugin/93metricsreloaded. IBM SPSS, available at: http://www03.ibm.com/software/products/en/spss-statistics. F. Hanandeh, A. A. Saifan , M.Akour, N. Al-Hussein, K. Shatnawi (2017). “ Evaluating Maintainability of Open Source Software: A Case Study ”. International Journal of Computer Science and Information Security. 15(2): 411-429.