Code generator quadrant
Code generators come in many flavors. In this article a code generator quadrant is presented based on the black-box versus white-box x-axis and the non developers versus developers y-axis. As there is no code generator that suits all purposes optimally, choosing the best one is a matter of properly anticipating its application and actual user.
What is a code generator?
Our definition of a code generator is ‘a software tool that generates source code based on meta code’. The generated source code can be Java, C#, Angular or any other language and framework. The meta code can be a representation of a process, an enriched model description or a combination of both.
Code generator assumptions
Especially software engineers can be rather reluctant with regards to code generation. Some assumptions we often encounter are:
- “Limited to boilerplate”
- “For initial project set-up only”
- “For simple applications”
- “Customizing generated source code is hard”
- “Creates code generator dependency”
- “Poor performance”
- “Ugly source code”
- “For the business, not for IT”
But these assumptions simply do not apply to all code generators, as we will explain…
Black-box versus white-box
A black-box code generator produces source code that cannot be influenced by the user. Some black-box code generators do not even show the generated source code. You simply add your meta code and the black-box generator will produce your source code. That’s it. The advantage of black-box code generators is that you will get your application within a fraction of the time you will normally need to create a similar application manually.
White-box code generators are more flexible. Users of white-box code generators can control the produced source code. By optimizing the meta code, you can create the same source code as you would have done manually, but faster and more consistent. The downside of white-box code generators is that you have to build and maintain a meta code library that fully suites your software architectural needs. That will take some time and investments.
Non developers versus developers
Some code generators focus on business users, or non developers. These code generators enable you to create, and often deploy a program without having IT development skills. A user friendly drag-and-drop interface helps creating your entities, processes, screens and reports.
Code generators for developers can provide a wizard that assists you in creating your meta code. Some graphical editors might be present. But code generators for developers often offer a text based interface to maintain your meta code.
Code generator quadrant
If we combine the black-box versus white-box x-axis with that of non developers versus developers y-axis we get a code generator quadrant. Let’s focus on each quadrant:
I – the simple applications, instant result quadrant (black-box for non developers)
In the black-box non developers quadrant you will find some popular code generators like Mendix, Outsystems, Betty Blocks and Camunda. There are many more, but this will give you a good idea of this quadrant. As they are black-box code generators you will get your application fast. But you cannot control the source code generated. But maybe that isn’t a problem as these code generators are not likely used for business critical IT applications. Black-box non developers code generators are also known as low-code development platforms.
II – the quick start quadrant (black-box for developers)
Tools like JHipster, JBoss Forge and Spring Roo can be found in the black-box developers quadrant. Great tools if you want to make a quick start with an application. You add your meta code to the tool and your source code is generated according to the architectural decisions made by the tool provider. Code generators in the black box developers quadrant are great for initial project set-up. After project set-up you alter the source code manually.
III – the complex applications quadrant (white-box for developers)
You will have to invest in tools in the white-box developers quadrant. Tools like Rascal, Eclipse Modeling Project and MetaFactory give software engineers the possibilities to generate code as they would have written it manually.You will have to adjust the meta code to let the code generator do exactly what you want him to do. After building a library of meta code in your organisation, the consistency of your software will increase. The productivity during software development and maintenance will improve dramatically.
These tools are valuable for both simple, as well as business critical applications.
IV – the holy grail quadrant (white-box for non developers)
Wouldn’t it be great to develop business critical applications that fully apply to the coding standards within your organisation without having IT development knowledge? Yeah. We haven’t seen any code generator that fits in this quadrant. There is no holy grail yet.
Road map MetaFactory
In order to reduce the investment time and learning curve to create your own code instruction sets, MetaFactory is making available ready to use code instruction sets on GitHub. This enables developers to start using MetaFactory as a black box developers tool, found in the quick start quadrant. But MetaFactory is offering developers the tool and training to modify the code instruction sets to change them to their own architectural design principles.