The builder, facade, and expression APIs

The process of interpreting an expression is a complicated process, where a lot of classes work together towards the goal. As an application developer, to focus on the task at hand, we might have to expose an API which abstracts away the complexities of lexical analysis, parsing, and AST generation. We normally use the GoF facade pattern in these contexts. But, we will use the GoF builder pattern here, as this creational pattern is more appropriate in situations where we need to create a composite object. Here, we create expressions which are modeled as composites:

 public class AbstractBuilder{} public class ExpressionBuilder : AbstractBuilder { public string _expr_string; public ExpressionBuilder(string ...

Get .NET 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.