Abstract. Design patterns have been a useful tool for a better understanding of the collaboration between several classes and objects in a program. One drawback of this approach is the lack of an explicit representation of the patterns used in a program, as the collaboration between classes is normally expressed in the code of the class itself. In this paper, we present a method for explicitly representing patterns in a program with the help of metaprogramming techniques. The method presented has benefits compared to traditional approaches with respect to documentation and reusability of the program, as well as providing a better separation of the protocol contained in the pattern.