8/07/2011

Design Pattern - Interpreter

Definition
Given a language, define a representation for its grammar along with an interpreter that uses the representation to interpret sentences in the language..

UML Class Diagram

Interpreter: when and where use it
- If your applications are complex and require advanced configuration you could offer a scripting language which allows the end-user to manipulate your application through simple scripting. The Interpreter design pattern solves this particular problem – that of creating a scripting language that allows the end user to customize their solution.  

- The truth is that if you really need this type of control it is probably easier and faster to use an existing command interpreter or expression evaluator tool out of the box. VBScript comes to mind, as well Microsoft?s new support for .NET Dynamic Languages.

Ref: Gang of Four tutorial

No comments:

Post a Comment