Investigating the effect of design patterns on energy consumption

Gang of Four (GoF) patterns are well‐known best practices for the design of object‐oriented systems. In this paper, we aim at empirically assessing their relationship to energy consumption, ie, a performance indicator that has recently attracted the attention of both researchers and practitioners. To achieve this goal, we investigate pattern‐participating methods (ie, those that play a role within the pattern) and compare their energy consumption to the consumption of functionally equivalent alternative (nonpattern) solutions. We obtained the alternative solution by refactoring the pattern instances using well‐known transformations (eg, replace polymorphism with conditional statements). The comparison is performed on 169 methods of 2 GoF patterns (namely, State/Strategy and Template Method), retrieved from 2 well‐known open source projects. The results suggest that for the majority of cases the alternative design excels in terms of energy consumption. However, in some cases (eg, when the method is large in size or invokes many methods) the pattern solution presents similar or lower energy consumption. The outcome of our study can be useful to both researchers and practitioners, because we: (1) provide evidence on a possible negative effect of GoF patterns, and (2) can provide guidance on which cases the use of the pattern is not hurting energy consumption.

[1]  Alexander Chatzigeorgiou,et al.  Energy Consumption Analysis of Design Patterns , 2007 .

[2]  Ioannis Stamelos,et al.  Design pattern alternatives: what to do when a GoF pattern fails , 2013, PCI '13.

[3]  Romain Rouvoy,et al.  A preliminary study of the impact of software engineering on GreenIT , 2012, 2012 First International Workshop on Green and Sustainable Software (GREENS).

[4]  Janice Singer,et al.  Guide to Advanced Empirical Software Engineering , 2007 .

[5]  G. Antoniol,et al.  Playing roles in design patterns: An empirical descriptive and analytic study , 2009, 2009 IEEE International Conference on Software Maintenance.

[6]  Lotfi Mhamdi,et al.  A survey on architectures and energy efficiency in Data Center Networks , 2014, Comput. Commun..

[7]  Ioannis Stamelos,et al.  Investigating the Use of Object-Oriented Design Patterns in Open-Source Software: A Case Study , 2010, ENASE.

[8]  Ralph Johnson,et al.  design patterns elements of reusable object oriented software , 2019 .

[9]  Johannes Stammel,et al.  Search-based determination of refactorings for improving the class structure of object-oriented systems , 2006, GECCO.

[10]  Mario Piattini,et al.  Analyzing the Harmful Effect of God Class Refactoring on Power Consumption , 2014, IEEE Software.

[11]  Romain Rouvoy,et al.  Monitoring energy hotspots in software , 2014, Automated Software Engineering.

[12]  Adel Noureddine,et al.  Optimising Energy Consumption of Design Patterns , 2015, 2015 IEEE/ACM 37th IEEE International Conference on Software Engineering.

[13]  Lerina Aversano,et al.  An empirical study on the evolution of design patterns , 2007, ESEC-FSE '07.

[14]  Ravi Jain,et al.  Towards understanding algorithmic factors affecting energy consumption: switching complexity, randomness, and preliminary experiments , 2005, DIALM-POMC '05.

[15]  Eric R. Ziegel,et al.  The Elements of Statistical Learning , 2003, Technometrics.

[16]  Ioannis Stamelos,et al.  Research state of the art on GoF design patterns: A mapping study , 2013, J. Syst. Softw..

[17]  Lori L. Pollock,et al.  Initial explorations on design pattern energy usage , 2012, 2012 First International Workshop on Green and Sustainable Software (GREENS).

[18]  Brian Huston,et al.  The effects of design pattern application on metric scores , 2001, J. Syst. Softw..

[19]  Gustavo Pinto,et al.  Understanding energy behaviors of thread management constructs , 2014, OOPSLA 2014.

[20]  Weisong Shi,et al.  pTop : A Process-level Power Profiling Tool , 2009 .

[21]  William C. Chu,et al.  A quantitative approach for evaluating the quality of design patterns , 2008, J. Syst. Softw..

[22]  André Vital Saúde,et al.  Persistent state pattern , 2010, PLOP '10.

[23]  Enrique S. Quintana-Ortí,et al.  Assessing Power Monitoring Approaches for Energy and Power Analysis of Computers , 2014, Sustain. Comput. Informatics Syst..

[24]  Ioannis Stamelos,et al.  An empirical investigation on the impact of design pattern application on computer game defects , 2011, MindTrek.

[25]  Romain Rouvoy,et al.  A review of energy measurement approaches , 2013, OPSR.

[26]  Matt Weisfeld,et al.  The Object-Oriented Thought Process , 2000 .

[27]  Lori L. Pollock,et al.  How do code refactorings affect energy usage? , 2014, ESEM '14.

[28]  Romain Rouvoy,et al.  Unit testing of energy consumption of software libraries , 2014, SAC.

[29]  Dietmar Pfahl,et al.  Reporting Experiments in Software Engineering , 2008, Guide to Advanced Empirical Software Engineering.

[30]  Mauricio A. Saca Refactoring improving the design of existing code , 2017, 2017 IEEE 37th Central America and Panama Convention (CONCAPAN XXXVII).

[31]  Romain Rouvoy,et al.  Runtime monitoring of software energy hotspots , 2012, 2012 Proceedings of the 27th IEEE/ACM International Conference on Automated Software Engineering.

[32]  Yu David Liu,et al.  Energy-efficient synchronization through program patterns , 2012, 2012 First International Workshop on Green and Sustainable Software (GREENS).

[33]  Günter Kniesel,et al.  Standing on the shoulders of giants - A data fusion approach to design pattern detection , 2009, 2009 IEEE 17th International Conference on Program Comprehension.

[34]  Andy P. Field,et al.  Discovering Statistics Using SPSS , 2000 .

[35]  Fernando Lyardet The Dynamic Template Pattern , 1997 .

[36]  Alexandre Bergel,et al.  Software metric for Java and C++ practices (Workpackage 1.1) , 2010 .

[37]  Apostolos Ampatzoglou,et al.  The Effect of GoF Design Patterns on Stability: A Case Study , 2015, IEEE Transactions on Software Engineering.

[38]  Giuseppe Procaccianti,et al.  A systematic literature review on energy efficiency in cloud software architectures , 2015, Sustain. Comput. Informatics Syst..

[39]  Robert Harper,et al.  Compiling polymorphism using intensional type analysis , 1995, POPL '95.

[40]  Andreas Winter,et al.  2nd Workshop Energy Aware Software-Engineering and Development (EASED@BUIS) , 2013 .

[41]  Christian Bunse,et al.  On the Energy Consumption of Design Patterns , 2013, Softwaretechnik-Trends.

[42]  Claes Wohlin,et al.  Experimentation in Software Engineering , 2000, The Kluwer International Series in Software Engineering.

[43]  Timo Johann,et al.  How to measure energy-efficiency of software: Metrics and measurement results , 2012, 2012 First International Workshop on Green and Sustainable Software (GREENS).

[44]  Sharad Malik,et al.  Instruction level power analysis and optimization of software , 1996, J. VLSI Signal Process..

[45]  Alexander Chatzigeorgiou,et al.  Design Pattern Detection Using Similarity Scoring , 2006, IEEE Transactions on Software Engineering.

[46]  Lori L. Pollock,et al.  SEEDS: a software engineer's energy-optimization decision support framework , 2014, ICSE.

[47]  Weisong Shi,et al.  Fine-grained power management using process-level profiling , 2012, Sustain. Comput. Informatics Syst..

[48]  Martin Fowler,et al.  Refactoring - Improving the Design of Existing Code , 1999, Addison Wesley object technology series.

[49]  Kevlin Henney Collections for States , 1999, EuroPLoP.

[50]  Sharad Malik,et al.  Instruction level power analysis and optimization of software , 1996, Proceedings of 9th International Conference on VLSI Design.

[51]  Joakim Nivre,et al.  Evaluation of Accuracy in Design Pattern Occurrence Detection , 2010, IEEE Transactions on Software Engineering.

[52]  Yue Zhang,et al.  A Distributed Architecture Based on Microbank Modules With Self-Reconfiguration Control to Improve the Energy Efficiency in the Battery Energy Storage System , 2016, IEEE Transactions on Power Electronics.