Design patterns automation with template library
Sergiu M. Dascalu, Ning Hao, N. Debnath · 2006
Design patterns offer reusable solutions to particular software design problems. Design patterns automation is an approach that applies design patterns at the implementation stage of the software development life cycle. Inspired by two commonly used template libraries, Active Template Library and Standard Template Library, and one of the most popular generic programming technologies, C++ templates, this paper introduces a new method for achieving design patterns automation. This method differs from the currently available UML-based and wizard-based design patterns automation techniques and provides support for increased flexibility, expandability and compatibility in developing software using design patterns. Seven of the patterns proposed by Gamma et al. have been implemented using C++ templates, namely singleton, factory method, visitor, memento, strategy, iterator, and decorator. To illustrate the method proposed, details of singleton and decorator implementations are provided and a larger "check" example developed using the decorator template is presented. The paper also includes a comparison with similar approaches and presents several directions of future work