Updated: Dec 27, 2020
MagicCodeGenerator is designed for developers and business analysts to significantly reduce development time for microservices and applications. Magic Code Generator (MCG engine) implements a model driven type of development. It aims at reducing 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.
Obviously not all code can be generated from a single model but the MCG engine can generate 60% and up to 80% of the required code in some circumstances. It is a powerful tool that literally generates code for microservices back-end while using common configurations using MongoDB for instance.
The current version downloadable on Visual Studio Marketplace allows developers to create a microservice using MongoDB as a back-end and creates the server code.
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.
Code is generated from a model describing the data structure to be stored in a database having a microservice interface. From the very same model, client code can also be generated. The current version of the MagicCodeGenerator Engine creates a microservice using MongoDB as the back-end database. We are working on "Packs" to generate microservices using Material or Bootstrap with MongoDB. You can register and get the latest on our new Packs.
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 as illustrated below.
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.