Micro Interpreters

Believing in Moore’s law and seeing that computer speed really doubles in around a year or two, reasonable linear slowdown of computer programs do not actually make it worth to create complex programs with lots of repeating code.

Instead I recommend creating simple data objects and the associated micro interpreters. Both are mostly small but always manageable units of code.

In current computer languages like C++ or C#, you can easily create any kind of acyclic directed graph describing domain language by implementing data objects which may include or refer to each other.

Doing this, you are able to nail down a language for which you are able to create actual instances directly inside your code. Then write an interpreter that executes the data objects and accesses the resources and facilities of your existing environment.

Conclusion:

  1. Think about if it is possible to describe a programming problem formally.
  2. If yes, specify and implement the language primitives that are required to solve your problem.
  1. Create the interpreter that executes the language.

To assure that the language is user friendly, I recommend to create the primitives before implementing the interpreter.

This is one simple pattern to move away from the daily creation of unmaintainable code!