We continue our season of software architecture patterns and more by reviewing the interpreter pattern. This one may seem familiar. It has been discussed in other areas of software development. However, it is worth refreshing our memory on this helpful solution.
The Interpreter Pattern Defined
The way this works is to start from a client, and given a context; we receive an expression. That may be a very simple or complex series of “sentences.” Next, the expression is broken down into parts that are individually interpreted. Finally, the combined results are sent back. That gives us yet another pattern that involves breaking the big problem down into smaller pieces. Thus, it is easier to solve.
Applying The Pattern
There are many opportunities for us to create a language in software and then use an interpreter. Likewise, every computer science student has spent some time with these sorts of problems. Of course, every computer language has this pattern implemented in some way. While the interpreter pattern may seem difficult to apply, it has potential in many areas. Therefore, it is worth considering as you design your approach. As you will see, it is another way to chop up a big problem into more manageable bites.