Chapter 10. Interpreter Pattern

Whether you loved or hated math class, those concepts equipped you to be where you are now. Even as early as algebra, core ideas were absorbed preparing you for your programming career. Algebra revolves around using variables to hold unknowns. Substituting values into the equation provided an interpretation of the variables to obtain the final result. Programming languages, like PHP, provide another form of interpretation. PHP generally is referred to as an interpreted language because its core installation does not compile the code ahead of time. PHP has also been referred to as a templating language. As more elaborate applications are created, this templating and interpreting becomes more advanced. More often than not, this template approach exists to allow the team to create entities in a less technical and complex way. The Interpreter Design Pattern is made to review these entities and provide a replacement for or interpretation of them to that template.

Name: Interpreter

The Interpreter Design Pattern analyzes an entity for key elements and provides its own interpretation or action corresponding to each key.

Get Professional PHP Design Patterns now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.