Abstract

With growing concerns regarding climate change and rising energy costs, there is an increased focus on improving the energy efficiency of software. One relevant avenue of research is the transformation of software designs in order to increase efficiency and reduce energy consumption. Design Patterns are of interest here as the indirection they introduce is likely to have a detrimental effect on energy consumption. In this paper we report on our investigations into the impact on energy consumption of the Decorator pattern, which is a structural design pattern used to enable additional behaviour to be attached to an individual component dynamically. Application of this pattern improves the maintainability of software at the cost of increased indirection and redundancy, which may reduce energy efficiency. In this paper we explore features of the Decorator pattern that impact on its systematic removal, with a future goal of removing this pattern using automated refactoring. We subsequently examine experimentally the Decorator pattern's impact on energy consumption in Java and find its implementation results in an increased number of instantiated objects and method invocations at run-time. The removal of the pattern can result in up to a 96% reduction in energy consumption in a best-case scenario with a textbook example, and up to a 5% reduction in energy consumption in an open-source project with a case study examining JUnit, a popular unit testing framework for Java. These results demonstrate the energy savings achievable with the removal of Decorator pattern instances and open the way for similar investigations of other design patterns.

Full Text
Published version (Free)

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call