It does your job better and faster than you can imagine
The generation of programming code is not new, it’s just gotten more important over time.
The objective of code generation is that after each change in machine-readable requirements (templates and entities), ALL application code are completely re-generated again.
This approach provides leverage over many applications, over time. It is simpler for individual developers to craft one-off code because the cost of building a generator would not yield enough benefit.
But here is where open-source really pays off. When a group of developers work together to create generator code, adoptors of the generatros profit from the cost of generator development.
However, the challenge of this approach is having defaults in the generator satisfy the needs of individual apps generated. Time to customize a generator may equal time for building from scratch for very unique applications.
Nevertheless, the increasing complexity of systems today (security, cloud, caching, etc.) means a lot of time is needed to make technology to work together. This is especially true considering the rapid churn of new and better tools over time.
Use of a system generator can reduce the time and frustration of understanding new technologies and time to code and test changes.
Code generation promises to churn out higher quality code in less time, and more consistently.
By focusing on generation of code, developers leverage their time over more apps. Fix a bug in the generator and it applies to all other apps.
Levels of Tools
There are several generations of code generation, each more sophisticated and magical than the next:
- Gen from static templates
- Gen client services from Swagger, RAML, or other client interface spec
- Gen from a database schema
- Gen from a JSON file
This approach to development involving code generation (rather than manually gluing various pieces together) is how one keeps apps up using all the latest tech stacks.
Testing the integration works for specific versions of various components is a complex affair. But here is the promise of open source delivered, where various strangers overcome a common technical challenge.
Gen from Static Templates
Here is the first generation of code generation.
Mustache substitutes values from data files in places where variables between are inserted in a template file. Data values are defined in JSON format.
Mustache is really a concept rather than a product. This simple technique is implemented in a wide variety of programming languages. It works on individual files.
repetitively creates a set of HTML files by applying the same template.
To generate multiple files from a single template, Generator from CodeSmith is for Windows only, $299 for single developers. A server product is $499. Its templates (with .csp file extension) are all about windows. It uses <% and %> markers ASP uses. It has templates that can generate complete applications for use on Windows, with ORM such as PLINQO (replacement of LINQ to SQL in C#) at
http://mygeneration.sourceforge.net/ is an open-source copycat of CodeSmith, and thus also focused on .NET Windows. It’s no longer maintained. Its website http://www.mygenerationsoftware.com/ was taken over in 2015.
Microsoft Visual Studio has a generator called T4 (Text Generation Transformation Toolkit)
Mo+ - model oriented programming language and IDE for model oriented development.
Jsonnet emits JSON on stdout from a commandline wrapper around the C API.
Microsoft Excel processes macros written in VBA (Visual Basic for Applications) programming language that can programmatically output files based on the contents of the spreadsheet.
Configuration managers Chef and Puppet generate files based on specification files in their own format.
2. Gen from client interface spec
See my dev-ecosystem
3. Gen UI from a database schema
Since the 90’s, Ironspeed.com generated web UI from Access databases until license hacks and patent trolls killed them.
4. Gen UI from a JSON file
Swagger-codegen generates client code from Swagger specification files.
5. Gen UI based on Entity Models
6. Gen UI based on an image of a screen
This is one of a series on Artificial Intelligence: