publications: - title: "A Pattern-Enforcing Compiler (PEC) for Java: A Practical Way to Formally Specify Patterns" author: - name: "Howard Lovatt" link: "http://plrg.science.mq.edu.au/projects/show/plrg" - name: "Anthony M. Sloane" link: "http://www.comp.mq.edu.au/~asloane" - name: "Dominic Verity" link: "http://www.comp.mq.edu.au/~domv" year: "2007" abstract: "This chapter describes an extended compiler that formalizes patterns, which we call a pat- tern enforcing compiler (PEC). Developers use standard Java syntax to mark their classes as implementations of particular design patterns. The compiler is then able to use reflec- tion to check whether the classes do in fact adhere to the constraints of the patterns. The checking possible with our compiler starts with the obvious static adherence to constraints such as method presence, visibility, and naming. However, we go much further and support dynamic testing to check the runtime behavior of classes and code generation to assist in the implementation of complex patterns. The chapter gives examples of using the patterns supplied with our PEC and also examples of how to write your own patterns and have our PEC enforce these." tags: - "Java" - "testing" - "constraints" - "code generation" - "compiler" - "design" researchr: "https://researchr.org/publication/Lovatt07" cites: 0 citedby: 0 booktitle: "Design Pattern Formalization Techniques" address: "Hershey, PA, USA" publisher: "Idea Group Inc." kind: "incollection" key: "Lovatt07"