DaDaBIK logo

Use cases: PHP code generator

Use DaDaBIK as a PHP code generator

What is a code generator?

It's basically a program that can build other programs, generating code according to specific parameters defined by the user.

Let's make an example: you have a database table customers and you need a program that allows your employees to access/modify the information related to your customers using Web forms and to export the information in PDF according to a specific template.

You can write the program from scratch, writing the code (in PHP, Python or any other programming language) or you can use a code generator that, since it has been designed to cover that specific use case (web forms, PDF generation), can generate the code for you according to some settings you specify. So a PHP code generator is a program that generates PHP code. Another popular term used to refer to same concept is PHP code maker.

Can you always use a code generator? It depends on the application you have to build but for typical data-based Web applications having forms as input interface and tabular grids / charts as output there is a very good chance you can automatically generate most of the code.

Is DaDaBIK a code generator?

Yes and no. You can use it for the same purpose of a PHP code generator:

  • create a program even if you are not a programmer
  • create a program faster (saving time and money) if you are a programmer

but the process is a bit different.

With a classic PHP code generator, you set some parameters and then you click a button to build the final application: this action generates some code (for example a set of .php files) that is the base of your application. You can run the code as it is or, if you have the skills, you can modify it. This is what also happens with a typical PHP form generator.

DaDaBIK, instead, is a so called model-based low-code platform: after having installed DaDaBIK, your Web application is ready to be used, it's empty but the skeleton of the application is already there; then you start adding tables, forms, reports and AS YOU do it, the Web application is updated, there is no code generation process.

Basically every time you create a new DaDaBIK app you are using the same DaDaBIK core code, which, according to specific settings you specify each time (mainly through a "point and click" approach), can materialize in different (even very different!) applications.

Classic code generator Vs. model-based low-code platform, which one is better?

You might think that generating the final code is better because you can edit it and therefore you have total control on it. It is true that you have total control on it but think twice: is editing the generated code a good idea?

What happens when a new version of your code generator comes out and you must update it (maybe because the previous version has a security bug)? You probably need to re-generate the code and not only you have to waste time re-applying the modifications you made but this might be complicated because the code generated with V.2 might be different respect to the code generated with V.1. Similar things might happen if you need to re-generate your code because there is a change in your data structure (e.g. new table fields).

With DaDaBIK you can add your own custom code if you want (for example you might need to add a custom button to a form that executes some specific Javascript code) but your code resides in separate files. Starting from V. 9, we invested a lot of energy on trying to separate the DaDaBIK core code from the users custom code so you can upgrade your application when a new DaDaBIK version comes out and keep your own custom code untouched.

Questions about this use case or about DaDaBIK in general? Contact us, we'll get in touch very soon.