amoghskulkarni / WebGME-MOCA

A domain-specific modeling language for running analyses on manufacturing process models
2 stars 0 forks source link

Data-model based code generation instead of using templates #28

Open amoghskulkarni opened 6 years ago

amoghskulkarni commented 6 years ago

As of now, all the code base is generated using templates which contain pretty elaborate logic for generating the custom code for everything.

It would be nice if the WebGME models result into an artifact (probably JSON file would be easier to generate than most others), which will be used by generic code blocks (for simulation components mainly) to give the same result. This will help in extending the simulation capabilities of the tool as follows -

E.g. if a simulation engine as well as simulation model in C++/Java is ready to be plugged, only things which are needed are 1. what are the parameters of the model, 2. what is the desired output and 3. how to run the simulation engine. The generic block needs to be written in that particular language (in which the simulation model and the engine is) which uses the data-model artifact to construct a desired simulation model and run it.

Bottom line: don't generate custom code, generate a data-model artifact which is to be used by a generic code block. The generic code block then uses the generated data-model artifact and behaves similar to a custom code block.

Pros:

  1. Easier to debug than templates-based code generation
  2. Easier to extend and maintain Cons:
  3. A lot of rework
  4. Generic code blocks tend to be slower than the custom generated code blocks