Solutions approach

We will divide the requirement into the two following parts:

  • A library for evaluating arbitrary mathematical expressions
  • An application which will consume the aforementioned library to plot data

The expression evaluator library requirements can be enumerated as follows:

  • Modeling expressions as AST
  • Writing a lexical analyzer
  • Writing a recursive descent parser
  • Depth first walk of the tree
  • Supporting trigonometric functions and pseudo variable ($)
  • Packaging everything as a facade pattern-based API

The application requirements can be enumerated as follows:

  • A screen with a WPF 2D graphics surface
  • A prompt for entering expressions
  • Implementation of the observer for detecting a new plot request
  • Passing the value to the expressions library for change ...

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.