Although patterns primarily constitute a body of knowledge for human consumption, several initiatives have been made to formalise some aspects of their representation, opening the way to some automated support for pattern-based development.
Formalisation is applied to some of the essential properties of patterns (pattern invariants) by means of specification languages, like the Object Constraint Language (OCL) . On the instantiation of a pattern or the modification of an existing occurrence of a pattern, its implementation may be automatically validated using the structural and behavioural/temporal constraints specified in OCL expressions. Such representations, although useful is such situations, cannot express all the knowledge (that a pattern encapsulates) required for instantiations or modifications. Furthermore, aspects like pattern intent, motivation and applicability, cannot be expressed in OCL.
Constraint languages and ontologies (proposed here) are complementary in pattern representation. The former are focussed on automatic code generation, whereas the latter are focussed on the provision of intelligent advice to software developers. Also, constraints and ontological representations operate at different stages--expressions represented in constraint languages become applicable after the engineer has made solution decisions.