About Paper

Android code smells are symptoms that something may be wrong in the system design or code, that may lead to poor software quality. Refactoring is an important activity to correct Android code smells in order to increase the maintainability and performance of mobile applications, especially pervasive applications. For this purpose, we present an empirical study to evaluate the effects caused by refactoring technique in 3 classic code smells: God Class, God Method and Feature Envy.

Goal and Research Questions

The main goal of this study is to evaluate if refactoring technique in Android improve the quality of the source-code. In addition, aim if this technique can reduce consumption of CPU and memory. We also conceived the following research questions (RQs) to guide our study.

RQ1 Does the refactoring technique in Android code smells improve the CPU consumption of the smartphone?
RQ2 Does the refactoring technique in Android code smells improve the memory of the smartphone?

Through RQ1, we are interested in investigating if refactoring technique can reduce the consumption of CPU in app Android. From RQ2, we aim to identify if this technique can be decreasing consumption of memory.

Evaluation Steps

To analyze the positive or negative impacts from applying the refactoring technique on mobile devices, we use a Moto G XT1032 smartphone. To minimize the risk of biasing in our study, we tested each application five times continuously, and we use the arithmetic mean of the achieved results to evaluate the impact from refactoring technique. Five steps were performed by our study to analyze the adopted refactoring techniques. These steps are illustrated in figure below and described the follows.

1) Code smells detections - We run the JDeodorant tool to detect three types of code smells: God Class, God Method, and Feature Envy. The nine applications analyzed were obtained from our data set.

2) Running applications with code smells in Android - From the data obtained in the previous step, we run each application individually, five times on the Moto G model XT1032 smartphone. With the termination of the five tests per application, we obtained the results of memory use and CPU consumption through the average of the five executions in each application

3) Refactoring using JDeodorant- From the conclusion of the previous steps, we can obtain the consumption of the features of the smartphone, such as memory and CPU. Therefore, the objective of this paper is to evaluate the positive or negative impacts of adopting the refactoring technique in mobile applications.

4) Run of the Apps after applying the refactoring technique - After us applying the automated refactoring technique through the JDeodorant tool was possible to identify if improved or deteriorated the consumption of memory and CPU.

5) Result analysis - At the end of all the previous steps, we obtained the data regarding the consumption of resources in Android that was submitted to refactoring technique. With these results, it is possible to compare the feasibility of this technique in mobile devices

Corpus of Android Apps

To investigate the impacts caused by Android smells and refactorings technique, we chose only apps from the context-aware domain for several reasons: First, these apps, in general, are intuitive and easy to evaluate; Second, there is a lot of apps available for download on GitHub. Third, these apps are strongly used since context-aware is a well-defined domain, the authors of this work believed that it would be easy to find code smells from this domain application; Fourth, one of the characteristics of this type of app is the need to use various hardware resources to identify the context, for instance, GPS and movement sensors.

APPLICATION (Link) LOC NOC NOM COMMITS CONTRIBUTORS RELEASES DESCRIPTION
RUNNERUP 39,401 187 2,534 2,075 28 56 An open source run tracker inspired by Garmin 410, RunKeeper and Every Where Run.
ANDROID ACTIVITY TRACKER 30,670 551 4,336 338 2 16 Android Activity Tracker is a GPS-tracking application
for tracking sportive activities, with emphasis on cycling.
It uses Maps Forge to display map tiles and offline
maps from the Open Street Map project.
CALENDULA 21,224 133 1,382 428 6 15 Calendula is an Android assistant for personal medication
management, aimed at those who have trouble
following their medication regimen, forget to take their
drugs or have complex schedules that are difficult to
remember
CYCLE STREETS 18,936 198 1,995 1,439 15 37 Cycle Streets is a UK-wide cycle journey planner
system, which lets you plan routes from A to B to
C by bike. It is designed by cyclists, for cyclists, and
caters for the needs of both confident and less confident
cyclists
TRAVEL-MATE 8,028 52 451 155 5 1 The app provides them with everything from choosing
the correct destination to making all the bookings and
to easily organizing the trip
STEPTASTIC 3,885 27 322 40 1 1 Steptastic is a step-counter for Android
FORECASTIE 2,907 23 19 451 33 17 An open-source weather app for Android
PEDOMETER 2,509 21 87 434 1 23 Lightweight pedometer app using the hardware stepsensor
for minimal battery consumption. This app is
designed to be kept running all the time without having
any impact battery life.
NOISE APP 1,821 12 81 98 3 1 The goal of the app is to have a noise map of the city,
in order to achieve better booking for tourist based on
their preferences: for example, young tourist may like
to be near a zone with high nightlife activities(so with
a higher noise of level) and vice-versa, for instance, a
family maybe want to avoid such places

Results

RQ1. Does the refactoring technique in Android code smells improve the CPU consumption of the smartphone?

RUNNERUP

ANDROID ACTIVITY TRACKER

CALENDULA

CYCLE STREETS

TRAVEL-MATE

STEPTASTIC

FORECASTIE

PEDOMETER

NOISE APP

RQ2. Does the refactoring technique in Android code smells improve the memory of the smartphone?

RUNNERUP

ANDROID ACTIVITY TRACKER

CALENDULA

CYCLE STREETS

TRAVEL-MATE

STEPTASTIC

FORECASTIE

PEDOMETER

NOISE APP

Data of our Experiments

We available the data of our experiments from 9 Android apps. We developed 5 tests per application. Therefore, there are 5 test spreadsheets per application and in total there are 45 spreadsheets. These spreadsheets are organized by code smell type.

God Class
God Method
Feature Envy
All Files for Download

We also provide all the tests in a unique package .zip for download Download