Visual Programming vs DSL
Tags: lowcode, programming
Published: 2023-02-13 11:49:29

Recently, low-code and no-code platforms have been gaining popularity. They propose to use visual programming to develop applications. In this approach, developers, who are ordinary business users, instead of writing program code, create an application using the mouse in a graphical interface.

But what are the advantages of visual programming compared to DSL (Domain Specific Language) ? Of course it depends on the application area. On the one hand, visual programming is almost never used in classical languages. At the same time, this approach certainly has many advantages when developing a graphical interface. However, for example, when creating interfaces with the popular React library, we use flat code more.

I see the following advantages in using DSL:

- Version control system support. In visual programming it is much less convenient to monitor changes in the logic of the program and resolve conflicts in commits.
- Ability to copy/paste, search and replace by text values, code generation.

In visual programming, the pluses include the following :

- Lower entry threshold. Most users know how to click on buttons, enter values in fields and drag and drop objects on forms.
- Better visualization when creating the user interface.

It should be mentioned that DSL and visual programming are not alternatives to each other. With the right approach, a visual constructor can and should generate DSL. XML is often used as such a language. However, the readability of XML leaves much to be desired.

One of the main drawbacks of visual programming is the very limited area of application. Yes, for creating simple CRUD applications it works rather well. But when some more complex logic is required, you have to return to program code anyway. This creates a certain semantic gap, when some of the logic is created visually and some is created with classic code.

Using DSL, in turn, allows you to create rather complicated applications with much less effort. Writing code in a specialized language can seem to be a difficult task for users. However, we should not forget that the SQL language was created exactly for regular users, and it is still used not only by programmers. And if DSL is as high-level as SQL, using normal words instead of special characters, the entry threshold is greatly reduced (here is an example of one such language).

Of course, for managing "dynamic" systems, a graphical interface is much better than a textual one. For example, most users do use the graphical interface of operating systems rather than the command console (although in my opinion, the console is more convenient in some places to manage servers). However, programs are more static systems. Typically, changes in the operation of the programs is carried out on a routine basis, rather rarely, and may lead to other significant changes (eg, data migration). And in this case the importance of checking the changes made, which is much easier to do just with flat program code, increases considerably.

One of the distinctive features of visual programming is that the developer immediately sees all the features of the development platform. By this he rarely has to refer to the documentation. On the other hand, it creates visual complexity, thereby "blurring the attention". It is more difficult for the developer to understand which settings he has changed, and which are set by default. In flat files, all changes can easily be seen with the version control system.

It is likely that in the near future, DSLs will increase in popularity in relation to visual programming, as AI technology develops. We've been trying to teach ChatGPT our brand new language, and the results have been very interesting and promising.