Abstract
Software engineers make use of design patterns for reasons that range from performance to code comprehensibility. Several design patterns capturing the body of knowledge of best practices have been proposed in the past, namely creational, structural and behavioral patterns. However, with the advent of mobile devices, it becomes a necessity a catalog of design patterns for energy efficiency. In this work, we inspect commits, issues and pull requests of 1027 Android and 756 iOS apps to identify common practices when improving energy efficiency. This analysis yielded a catalog, available online, with 22 design patterns related to improving the energy efficiency of mobile apps. We argue that this catalog might be of relevance to other domains such as Cyber-Physical Systems and Internet of Things. As a side contribution, an analysis of the differences between Android and iOS devices shows that the Android community is more energy-aware.
Similar content being viewed by others
Notes
StackOverflow is a collaborative Web platform for questions and answers on a wide range of topics in computer programming.
Swift is the official programming language for iOS apps.
GitHub is a social coding platform with a git web interface.
F-droid’s website: https://f-droid.org/ (Visited on January 26, 2019).
Signal is an open source messaging app: https://signal.org (Visited on January 26, 2019).
Amazing open source Android apps curated list available here: https://github.com/Mybridge/amazing-android-apps (Visited on January 26, 2019).
The list is available here: https://github.com/dkhamsing/open-source-ios-apps (Visited on January 26, 2019)
The whole thread can be found here: https://github.com/wordpress-mobile/WordPress-iOS/issues/6057 (Visited on January 26, 2019).
The whole thread can be found here: https://github.com/minetest/minetest/issues/6394 (Visited on January 26, 2019).
The whole thread can be found here: https://github.com/ChatSecure/ChatSecure-iOS/issues/31 (Visited on January 26, 2019).
An example can be found here: https://github.com/hrydgard/ppsspp/issues/7765 (Visited on January 26, 2019).
Documentation of GitHub REST API v3 available here: https://developer.github.com/v3/ (Visited on January 26, 2019).
AMOLED is a display technology used in mobile devices and stands for Active Matrix Organic Light Emitting Diodes.
Fibonacci series is a sequence of numbers in which each number is the sum of the two preceding numbers (e.g., 1, 1, 2, 3, 5, 8, etc.).
Energy Efficiency Guide for iOS Apps – Avoid Extraneous Graphics and Animations available here: https://developer.apple.com/library/archive/documentation/Performance/Conceptual/EnergyGuide-iOS/AvoidExtraneousGraphicsAndAnimations.html (Visited on January 26, 2019).
This is a real example that can be found here: https://github.com/signalapp/Signal-Android/commit/cb9f225f5962d399f48b65d5f855e11f146cbbcb (Visited on January 26, 2019).
Energy Efficiency Guide for iOS Apps – Avoid Extraneous Graphics and Animations available here: https://developer.apple.com/library/archive/documentation/Performance/Conceptual/EnergyGuide-iOS/AvoidExtraneousGraphicsAndAnimations.html (Visited on January 26, 2019).
An example of developers dealing with the strict policy of the iOS app store: https://github.com/owncloud/ios/issues/13 (Visited on January 26, 2019).
Until mid 2018, iPhone X was the only iOS smartphone with an AMOLED screen.
References
Agolli T, Pollock L, Clause J (2017) Investigating decreasing energy usage in mobile apps via indistinguishable color changes. In: 2017 IEEE/ACM 4th international conference on mobile software engineering and systems (MOBILESoft). IEEE, pp 30–34
An K, Meng N, Tilevich E (2018) Automatic inference of java-to-swift translation rules for porting mobile applications. In: Proceedings of the 5th International Conference on Mobile Software Engineering and Systems, ser. MOBILESoft ’18.New York, NY, USA: ACM, pp 180–190. [Online]. Available: https://doi.org/10.1145/3197231.3197240
Banerjee A, Roychoudhury A (2016) Automated re-factoring of android apps to enhance energy-efficiency. In: Proceedings of the international workshop on mobile software engineering and systems. ACM, pp 139–150
Banerjee A, Chong LK, Chattopadhyay S, Roychoudhury A (2014) Detecting energy bugs and hotspots in mobile apps. In: Proceedings of the 22nd ACM SIGSOFT international symposium on foundations of software engineering (FSE). ACM, pp 588–598
Bao L, Lo D, Xia X, Wang X, Tian C (2016) How android app developers manage power consumption?: an empirical study by mining power management commits. In: Proceedings of the 13th international conference on mining software repositories. ACM, pp 37–48
Behrouz RJ, Sadeghi A, Garcia J, Malek S, Ammann P (2015) Ecodroid: an approach for energy-based ranking of android apps. In: 2015 IEEE/ACM 4th international workshop on green and sustainable software (GREENS). IEEE, pp 8–14
Boonkrong S, Dinh PC (2015) Reducing battery consumption of data polling and pushing techniques on android using gzip. In: 2015 7th international conference on information technology and electrical engineering (ICITEE). IEEE, pp 565–570
Cai H, Zhang Y, Jin Z, Liu X, Huang G (2015) Delaydroid: reducing tail-time energy by refactoring android apps. In: Proceedings of the 7th Asia-Pacific symposium on internetware. ACM, pp 1–10
Carette A, Younes MAA, Hecht G, Moha N, Rouvoy R (2017) Investigating the energy impact of android smells. In: 2017 IEEE 24th International Conference on software analysis, evolution and reengineering (SANER). IEEE, pp 115–126
Cassee N, Pinto G, Castor F, Serebrenik A (2018) How swift developers handle errors. In: 15th international conference on mining software repositories (MSR), p 2018
Chowdhury S, Borle S, Romansky S, Hindle A (2018) Greenscaler: training software energy models with automatic test generation, pp 1–44
Chowdhury S, Di Nardo S, Hindle A, Jiang ZMJ (2018) An exploratory study on assessing the energy impact of logging on android applications. Empir Softw Eng 23(3):1422–1456
Corral L, Georgiev AB, Janes A, Kofler S (2015) Energy-aware performance evaluation of android custom kernels. In: 2015 IEEE/ACM 4th international workshop ongreen and sustainable software (GREENS). IEEE, pp 1–7
Cruz L, Abreu R (2017) Performance-based guidelines for energy efficient mobile applications. In: IEEE/ACM international conference on mobile software engineering and systems, MobileSoft 2017, pp 46–57
Cruz L, Abreu R (2018) Using automatic refactoring to improve energy efficiency of android apps. In: CIbSE XXI Ibero-American conference on software engineering
Cuadrado F, Dueñas JC (2012) Mobile application stores: success factors, existing approaches, and future developments. IEEE Commun Mag 50(11):160–167
Di Nucci D, Palomba F, Prota A, Panichella A, Zaidman A, De Lucia A (2017) Software-based energy profiling of android apps: simple, efficient and reliable?. In: 2017 IEEE 24th international conference on software analysis, evolution and reengineering (SANER). IEEE, pp 103–114
Fereday J, Muir-cochrane E (2006) Demonstrating rigor using thematic analysis: a hybrid approach of inductive and deductive coding and theme development. International Journal of Qualitative Methods 5(1):80–92
Gottschalk M, Jelschen J, Winter A (2014) Saving energy on mobile devices by refactoring. In: EnviroInfo, pp 437–444
Hao S, Li D, Halfond WG, Govindan R (2013) Estimating mobile application energy consumption using program analysis. In: Proceedings of the 2013 international conference on software engineering (ICSE). IEEE Press, pp 92–101
Hecht G, Moha N, Rouvoy R (2016) An empirical study of the performance impacts of android code smells. In: Proceedings of the international workshop on mobile software engineering and systems. ACM, pp 59–69
Hindle A, Wilson A, Rasmussen K, Barlow EJ, Campbell JC, Romansky S (2014) Greenminer: a hardware based mining software repositories software energy consumption framework. In: Proceedings of the 11th working conference on mining software repositories. ACM, pp 12–21
Kim D, Jung N, Chon Y, Cha H (2016) Content-centric energy management of mobile displays. IEEE Trans Mob Comput 15(8):1925–1938
Li D, Halfond WG (2014) An investigation into energy-saving programming practices for android smartphone app development. In: Proceedings of the 3rd international workshop on green and sustainable software. ACM, pp 46–53
Li D, Tran AH, Halfond WG (2014) Making web applications more energy efficient for oled smartphones. In: Proceedings of the 36th international conference on software engineering (ICSE). ACM, pp 527– 538
Li D, Tran AH, Halfond WG (2015) Nyx: a display energy optimizer for mobile web apps. In: Proceedings of the 2015 10th joint meeting on foundations of software engineering (FSE). ACM, pp 958–961
Linares-Vásquez M, Bavota G, Bernal-Cárdenas C, Oliveto R, Di Penta M, Poshyvanyk D (2014) Mining energy-greedy api usage patterns in android apps: an empirical study. In: Proceedings of the 11th working conference on mining software repositories. ACM, pp 2–11
Linares-Vásquez M, Bernal-Cárdenas C, Bavota G, Oliveto R, Di Penta M, Poshyvanyk D (2017) Gemma: multi-objective optimization of energy consumption of guis in android apps. In: Proceedings of the 39th international conference on software engineering companion. IEEE Press, pp 11–14
Liu Y, Xu C, Cheung S-C (2013) Where has my battery gone? Finding sensor related energy black holes in smartphone applications. In: 2013 IEEE international conference on pervasive computing and communications (PerCom). IEEE, pp 2–10
Liu Y, Xu C, Cheung S-C, Terragni V (2016) Understanding and detecting wake lock misuses for android applications. In: Proceedings of the 2016 24th ACM SIGSOFT international symposium on foundations of software engineering (FSE). ACM, pp 396–409
Manotas I, Bird C, Zhang R, Shepherd D, Jaspan C, Sadowski C, Pollock L, Clause J (2016) An empirical study of practitioners’ perspectives on green software engineering. In: 2016 IEEE/ACM 38th international conference on software engineering (ICSE). IEEE, pp 237–248
Martin W, Sarro F, Jia Y, Zhang Y, Harman M (2017) A survey of app store analysis for software engineering. IEEE Trans Softw Eng 43(9):817–847
McIntosh A, Hassan S, Hindle A (2018) What can android mobile app developers do about the energy consumption of machine learning? Empir Softw Eng, pp 1–40. https://link.springer.com/article/10.1007/s10664-018-9629-2
Metri G, Agrawal A, Peri R, Shi W (2012) What is eating up battery life on my smartphone: a case study. In: 2012 international conference on energy aware computing. IEEE, pp 1–6
Moura I, Pinto G, Ebert F, Castor F (2015) Mining energy-aware commits. In: Proceedings of the 12th working conference on mining software repositories. IEEE Press, pp 56–67
Negara S, Codoban M, Dig D, Johnson R (2014) Mining fine-grained code changes to detect unknown change patterns. In: Proceedings of the 36th international conference on software engineering (ICSE). ACM, pp 803–813
Oliveira W, Oliveira R, Castor F (2017) A study on the energy consumption of android app development approaches. In: 2017 IEEE/ACM 14th international conference on mining software repositories (MSR). IEEE, pp 42–52
Palattella MR, Dohler M, Grieco A, Rizzo G, Torsner J, Engel T, Ladid L (2016) Internet of things in the 5g era: Enablers, architecture, and business models, vol 34, pp 510–527
Palomba F, Di Nucci D, Panichella A, Zaidman A, De Lucia A (2017) Lightweight detection of android-specific code smells: the adoctor project. In: 2017 IEEE 24th international conference on software analysis, evolution and reengineering (SANER). IEEE, pp 487–491
Palomba F, Tamburri DA, Serebrenik A, Zaidman A, Fontana FA, Oliveto R (2018) How do community smells influence code smells?. In: Proceedings of the 40th International Conference on Software Engineering Companion. ACM, pp 240–241
Palomba F, Di Nucci D, Panichella A, Zaidman A, De Lucia A (2019) On the impact of code smells on the energy consumption of mobile applications. Inf Softw Technol 105:43–55
Pascarella L, Geiger F-X, Palomba F, Di Nucci D, Malavolta I, Bacchelli A (2018) Self-reported activities of android developers. In: 5th IEEE/ACM international conference on mobile software engineering and systems, New York, NY
Pathak A, Hu YC, Zhang M (2011) Bootstrapping energy debugging on smartphones: a first look at energy bugs in mobile devices. In: Proceedings of the 10th ACM workshop on hot topics in networks. ACM, p 5
Pathak A, Hu YC, Zhang M (2012) Where is the energy spent inside my app?: fine grained energy accounting on smartphones with eprof. In: Proceedings of the 7th ACM european conference on computer systems. ACM, pp 29–42
Pathak A, Hu YC, Zhang M, Bahl P, Wang Y-M (2011) Fine-grained power modeling for smartphones using system call tracing. In: Proceedings of the 6th conference on computer systems. ACM, pp 153–168
Pathak A, Jindal A, Hu YC, Midkiff SP (2012) What is keeping my phone awake?: characterizing and detecting no-sleep energy bugs in smartphone apps. In: Proceedings of the 10th international conference on Mobile systems, applications, and services. ACM, pp 267–280
Pham R, Singer L, Liskin O, Filho FF, Schneider K (2013) Creating a shared understanding of testing culture on a social coding site. In: Proceedings of the 2013 international conference on software engineering (ICSE). IEEE Press, pp 112–121
Pham R, Stoliar Y, Schneider K (2015) Automatically recommending test code examples to inexperienced developers. In: Proceedings of the 2015 10th joint meeting on foundations of software engineering (FSE). ACM, pp 890–893
Pinto G, Castor F, Liu YD (2014) Mining questions about software energy consumption. In: Proceedings of the 11th working conference on mining software repositories. ACM, pp 22–31
Reimann J, Brylski M, Aßmann U (2014) A tool-supported quality smell catalogue for android developers. In: Proceedings of the conference Modellierung 2014 in the Workshop modellbasierte und modellgetriebene softwaremodernisierung–MMSM, vol 2014
Robillard MP, Medvidovic N (2016) Disseminating architectural knowledge on open-source projects: a case study of the book architecture of open-source applications. In: 2016 IEEE/ACM 38th international conference on software engineering (ICSE).IEEE, pp 476–487
Romansky S, Borle NC, Chowdhury S, Hindle A, Greiner R (2017) Deep green: modelling time-series of software energy consumption. In: 2017 IEEE international conference on software maintenance and evolution (ICSME). IEEE, pp 273–283
Sahin C, Cayci F, Gutiérrez ILM, Clause J, Kiamilev F, Pollock L, Winbladh K (2012) Initial explorations on design pattern energy usage. In: 2012 1st international workshop on green and sustainable software (GREENS). IEEE, pp 55–61
Sahin C, Pollock L, Clause J (2016) From benchmarks to real apps: exploring the energy impacts of performance-directed changes. J Syst Softw 117:307–316
Shafer I, Chang ML (2010) Movement detection for power-efficient smartphone wlan localization. In: Proceedings of the 13th ACM international conference on modeling, analysis, and simulation of wireless and mobile systems. ACM, pp 81–90
Sousa L, Oliveira A, Oizumi W, Barbosa S, Garcia A, Lee J, Kalinowski M, de Mello R, Fonseca B, Oliveira R et al (2018) Identifying design problems in the source code: a grounded theory. In: Proceedings of the 40th international conference on software engineering (ICSE). ACM, pp 921–931
Vekris P, Jhala R, Lerner S, Agarwal Y (2012) Towards verifying android apps for the absence of no-sleep energy bugs. In: HotPower
Vlissides J, Helm R, Johnson R, Gamma E (1995) Design patterns: elements of (Vlissides et al. 1995) reusable object-oriented software, Addison-Wesley, Boston
White J, Clarke S, Groba C, Dougherty B, Thompson C, Schmidt DC (2010) R&d challenges and solutions for mobile cyber-physical applications and supporting internet services. J Int Serv Appl 1(1):45–56
Wilke C, Götz S, Richly S (2013) Jouleunit: a generic framework for software energy profiling and testing. In: Proceedings of the 2013 workshop on Green in/by software engineering. ACM, pp 9–14
Yskout K, Scandariato R, Joosen W (2015) Do security patterns really help designers?. In: 2015 IEEE/ACM 37th IEEE international conference on software engineering (ICSE), vol 1. IEEE, pp 292–302
Zhang L, Tiwana B, Dick RP, Qian Z, Mao ZM, Wang Z, Yang L (2010) Accurate online power estimation and automatic battery behavior based power model generation for smartphones. In: 2010 IEEE/ACM/IFIP international conference on hardware/software Codesign And System Synthesis (CODES+ ISSS). IEEE, pp 105–114
Acknowledgment
This work is financed by the ERDF — European Regional Development Fund through the Operational Program for Competitiveness and Internationalization - COMPETE 2020 Program and by National Funds through the Portuguese funding agency, FCT - Fundação para a Ciência e a Tecnologia with reference UID/CEC/50021/2019, and within projects GreenLab (POCI-01-0145-FEDER-016718) and FaultLockerRef (PTDC/CCI-COM/29300/2017). Luis Cruz is sponsored by an FCT scholarship grant number PD/BD/52237/2013. Furthermore, we would like to thank Sofia Reis for the illustrations of energy patterns.
Author information
Authors and Affiliations
Corresponding author
Additional information
Communicated by: David Lo, Meiyappan Nagappan, Sebastiano Panichella, and Fabio Palomba
Publisher’s note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Appendix: Grey Literature
Appendix: Grey Literature
-
[1]
Apple Developer Documentation Archive. Energy Efficiency Guide for iOS Apps – Avoid Extraneous Graphics and Animations. URL: https://developer.apple.com/library/archive/documentation/Performance/Conceptual/EnergyGuide-iOS/AvoidExtraneousGraphicsAndAnimations.html
-
[2]
Daniel Gultsch. The State of Mobile XPP in 2016. URL: https://gultsch.de/xmpp_2016.html
-
[3]
Alternative Push Notification Transport. URL: https://github.com/matrix-org/GSoC/blob/master/IDEAS.md#alternative-push-notification-transport
-
[4]
Apple Developer Documention Archive. Energy Efficiency Guide for iOS Apps – React to Low Power Mode on iPhones. URL: https://developer.apple.com/library/archive/documentation/Performance/Conceptual/EnergyGuide-iOS/LowPowerMode.html
-
[5]
Stackoverflow. Is gzip compression useful for mobile devices?. URL: https://stackoverflow.com/questions/3065920/is-gzip-compression-useful-for-mobile-devices
-
[6]
Mitch Bartlett. Does Wi-Fi Consume More Battery Power Than 3G or 4G/LTE?. URL: https://www.technipages.com/does-wi-fi-consume-more-battery-power-than-3g-or-4glte
-
[7]
Android SDK Documentation. Modifying your Download Patterns Based on the Connectivity Type. URL: https://developer.android.com/training/efficient-downloads/connectivity_patterns
-
[8]
Apple Developer Documentation Archive. Energy Efficiency Guide for iOS Apps – Energy and Networking. URL: https://developer.apple.com/library/archive/documentation/Performance/Conceptual/EnergyGuide-iOS/EnergyandNetworking.html
-
[9]
Android SDK Documentation. Optimizing for Doze and App Standby. URL: https://developer.android.com/training/monitoring-device-state/doze-standby
-
[10]
Android SDK Documentation. Android Developer Guides — Optimizing for Battery Life. URL: https://developer.android.com/topic/performance/power/
-
[11]
Android Developers Youtube Channel. DevBytes: Efficient Data Transfers - Batching, Bundling, and SyncAdapters. URL: https://www.youtube.com/watch?v=5onKZcJyJwI
-
[12]
Apple’s Core Location Documentation. CLLocationManager. URL: https://developer.apple.com/documentation/corelocation/cllocationmanager
Rights and permissions
About this article
Cite this article
Cruz, L., Abreu, R. Catalog of energy patterns for mobile applications. Empir Software Eng 24, 2209–2235 (2019). https://doi.org/10.1007/s10664-019-09682-0
Published:
Issue Date:
DOI: https://doi.org/10.1007/s10664-019-09682-0