It does your job better and faster than you can imagine
Overview
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.
Challenges
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
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
-
Gen entire stack from an Entity Model
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.
https://www.npmjs.com/package/mustache-prestatic
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
https://github.com/codesmithtools/Templates/releases -
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)
-
https://github.com/moplus/modelorientedplus
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.
http://docs.aws.amazon.com/codebuild/latest/userguide/build-spec-ref.html
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
More
This is one of a series on Artificial Intelligence:
- AI Ecosystem
- Machine Learning
- Microsoft’s AI
- Microsoft’s Azure Machine Learning Algorithms
- Microsoft’s Azure Machine Learning tutorial
- Python installation
- Image Processing
- Tessaract OCR using OpenCV
- Multiple Regression calculation and visualization using Excel and Machine Learning
- Tableau Data Visualization