Hello! I'll start the article with a small digression. Were you disappointed when you first encountered programming? I assumed that the creation of programs occurs through interaction with some complex, but very interesting tool, in which I can do my favorite thing (collect constructors) at a new level. However, instead, I had to learn how to write text files consisting of various operators, brackets, strings, and other text constructs. Decades passed, I learned to program, and I had already forgotten about this disappointment, but when I saw the news about Google Blockly and Scratch on the network, I felt nostalgia ...
These tools, without even claiming to be professional, are so interesting! No texts and compilations - you drag blocks and instantly get the result. Can this be done for professionals? I am sure that you can! And in this article I would like to express my vision of how.
What is the point?
If we move away from the test way of writing programs, we need to separate the structure of the program code and its type ...
Like this?
To do this, first of all, we need to store the source codes in a different form. They should be a description of the instructions and program data in one of the existing forms of data storage, such as json, xml or any other. This file (Figure 1, left) can have a rather ugly appearance and does not succumb to any reasonable way to directly edit it, however, in a programming environment it will turn into block code (Figure 1, right).
The programming environment itself is not dealing with text codes, but with the βblocksβ from which the program code is built.
What will it give us?
1. Firstly, we will get rid of insignificant differences in the syntax of various languages. For example, code blocks in C ++ are separated by curly braces, and Ruby pays attention to keywords ... In the editor, you can configure both types of programs, nothing will change in it. Personal display settings will allow the developer to look at the program as he likes. In addition, we can use any characters in the naming, including spaces.
2. Secondly, the speed of writing a program will increase. Now, in order to write a for statement in a C-like language, we need to write the for text itself, then the brackets, parameters, semicolons, curly braces, and press enter. In our version, the programming environment, by clicking on a certain combination of keys, inserts a cycle and requires only to enter its parameters. For example, pressing βfβ will put the for loop in place of the cursor and offer to enter the number of repetitions and the name of the counter via tabulation by pressing the enter key at the end.
3. Thirdly, it will be possible to ensure independence from the language of the programmer. Language operators may be indicated by some characters, or keywords may be displayed in the native language of the programmer. If he wants the operators to be called in English, Russian or in any other language, he selects this language in the editor settings and the names of the operators change "on the fly." As for the names of objects and methods, itβs more complicated, but in any case, if the program is developed by Russian developers, you can name everything in Russian - if you select this scenario there will be no discrepancy between the names of the operators and the names of objects and methods - everything will be in Russian. This can simplify learning for students and adults unfamiliar with English. And besides, in multinational teams it is possible to use two names for naming objects and methods - in English and in the developer's language.
4. Fourth, it will be possible to update the structure of the program. If some new feature appears in the new version of the standard that changes the look of block designs, it will be possible to release patches for old programs that will automatically bring them into a new look. In Figure 4, you can see what old language constructs can be transformed by the programming environment to a new form.
5. Fifthly, it will be possible to represent the structure of the program in any convenient way. For example, in the form of a three-dimensional room through which you can navigate like computer games and edit the relationship of three-dimensional classes and objects.
Programming environment
This way of presenting the program will no longer allow you to change it in a simple text editor. To edit the program you will need a special programming environment. Developing the first version of this programming environment is more difficult than for traditional languages, but there are ways to get started easier. For example, you can start with the data file editor, which allows you to edit files of any format (xml, json, yaml, etc.) in the same way - using blocks. In this case, the user will be spared the need to study the syntax of these files and will be able to edit any of them by learning how to edit data files only in this program.
Then there will be the task of developing a compiler that can βon the flyβ build a program during its editing. And in the future, it will be easier to provide autocompletion functionality and add functions to the development environment that require "deep" knowledge of the program code, since you do not have to parse text codes. In addition, the programming environment will βknowβ everything that is needed about the program for better syntax highlighting and refactoring, since all the data needed for this can be stored invisibly for the programmer in the program data file.
Conclusion
I am sure that the described programming method will open up great opportunities for programmers and will greatly speed up and simplify application development. However, one in the field is not a warrior. Developing such a product requires a powerful approach and resources. I am a loner and work remotely - this project is too tough for me ... Perhaps if you became interested in him, could we work together?