man in the matrix

Technology review – Automatic programming

“Write code that writes code…”

This is the one of the most interesting arguments found in the book, The Pragmatic Programmer.”

Programmers too have wondered if there are ways of simplifying the coding process.

Imagine having predefined lines of code like headers, libraries, and constructors written already.

Is it achievable?

It is believed that there’s already an automation of programming way back then but it is not meant with today’s generation of programs.

Tl; dr;

Automatic Computer Programming or simply automatic programming is a type of computer programming wherein a program code is automatically generated by another program based on certain specifications.Meaning, a program that writes more code is written, which then goes on and creates more programs.

It is a combination of Artificial Intelligence and Compilers techniques.

The Automatic Programming

automatic programming principle


The argument about whether or not “a code that writes a code” is actually true and it is called, Automatic Programming.

Way back 1940s, there’s already a code automation, BUT it is not what you think it is.

Automatic programming then was about automating the manual process of paper-tape punching which were the programs of punched card machines.

Later on, it meant the translation of high-level programming languages such as Fortran and ALGOL into low-level machine code.

The concrete definition of today’s automatic programming is like an automated approach to programming where the end-user specifies certain high-level specifications(easily understood by humans) and the program converts it into machine executable code.


AI techniques and Compilers help for the completion of this type of programming:

Artificial Intelligence.

Whether by humans or by machine, writing programs is based on knowledge of algorithms, data structures, design patterns.

  • Needed to represent, find, and instantiate design patterns.
  • Search may be needed in finding a combination of components to accomplish the desired task.


Representing the code in the form of Abstract syntax trees, compiler techniques are used in generating and manipulating programs. Techniques such as code optimization are used so the generated code is efficient in all aspects.

  • It is better to know what optimizations a compiler can perform, so the program generator does not need to duplicate those.
  • As used by compilers, the central representation of a program is the Abstract Syntax Tree (AST).
  • Lisp code can be viewed as a kind of AST.


Automatic programming can be divided into two (2) categories:

  •  Generative Programming. It is where standard libraries are used to improve the efficiency and speed of programming. The programmer does not need to re-implement it or even need to know how it works. For instance glut.h a graphics library for C++ for easily implementing OpenGL programs.
  • Source Code Generation. A real interest to AI researchers, source code is generated based on a model or template which is made through a programming tool or an integrated development environment (IDE). One good example is the Google/MIT App Inventor where users simply need to drag and drop functions that they want and then visually connect them to each other to define how the app works without ever typing any lines of code.

Popular Uses of Automatic Programming

Microsoft’s T4 (Text Template Transformation Toolkit), consists of template code which users see at design time and then this code is converted to output code at run-time saving them the overhead of writing all the code manually.

Accelo a code generator for eclipse is used in generating text-representation in languages like (PHP, Python, Java, etc.) from Eclipse Framework models defined in UML. Actifsource is a plugin for Eclipse that allows graphical modelling using templates.


In the future, programmers won’t need to write code anymore and this task would be fully automated.

There’s no reason to panic about this.

The trade would still continue but it would just develop from specific problem solving to general problem solving.

Additionally, domain knowledge varies in complexity and so far only humans are capable of devising solutions to specific problems.

By Tuan Nguyen

Leave a Reply

Your email address will not be published. Required fields are marked *