Updated: Dec 8, 2020
Magic Code Generator implements a model driven type of development. It aims to reduce the amount of redundant code developers have to write again and again for each new project by generating platform dependent code from a single model. Off course, not all code can be generated from a single model but at least it can generate from 60% and up to 80% of the required code in some circumstances.
In a nutshell, at first a model is defined to represent what we intent to obtain and not how to obtain it. This is the main difference between declarative and imperative programming. Model base development is declarative. Then, the model is passed to a template. This could be a simple code template with data insertion or a more elaborate program performing the transformation into code.
The end result is a set of documents, mostly code but also installation scripts like Dockerfiles, configuration files like nodeJS package.json, etc. So, it is not limited to code generation, and this is what distinguishes Magic Code Generator from actual modeling tools. It generates the environment required to run successfully the code produced.
A Magic Code model structure is based on the notion of singletons and collections. For example, in the figure below the order book model is a singleton and the order model is a collection. The graphical representation below specifies that a market (a singleton) has many orders (collections). In fact, a market owns two collections based on the order model, one for the asks and one for the bids.
In the future, we plan to have a graphical tool to represent the models. For the moment, these models can be defined within Visual Studio Code. Magic Code Generator is actually integrated into Visual Studio Code as a VS code extension attached to .mdl files. Models are associated to the .mdl file extension. Since Visual Studio Code runs on Windows, Linux, MacOS, so is also running the Magic Code Generator.