Games and other in programming

Игры, математика, программирование, и просто размышлизмы

понедельник, 24 января 2022 г.

Programming without programmers and what prevents its development

 Programming without programmers and what prevents its development

A mechanic, a chemist, and a programmer are driving in the car.

Suddenly the car stalled.

Mechanic: "Probably there is something with the motor."

Chemist: "No, it's a bad gasoline."

Programmer: "Raise my salary." © A joke


Quarantine and lockdown have forced businesses to go online: grocery delivery, entertainment, shopping, meetings, games, chatting with friends, and even sex - everything now happens on the Internet. Offline businesses have intensified with vaccinations in the US and Europe. Their development needs remain relevant. Accordingly, the already considerable demand for programmers increased greatly.

If earlier they were recruited in third world countries in order to save money, nowadays the limits of this source have been reached. According to djinni.co, the ratio between applicants and vacancies has grown exponentially since November 2020, and not in favor of recruiters. Business is in agony: there are simply no free hands and heads on the labor market. You have to lure people away from their current employer, offering higher wage (the Ukrainian Diya City was just made to enslave developers) If the lure attempt was successful, uneasy one uneasy feeling will change the other, because tomorrow someone may offer even more to the newly acquired worker...

What can be done in order to get out of this unpleasant cycle of suffering? Teaching programming to beginners is a task with low time efficiency, and there are no guarantees that a neophyte will not run away to some other company that offered him a counteroffer with a higher monthly salary.

Is it possible, at least in typical cases, to do without these snickering, capricious, and at the same time expensive bastards, known as programmers? Is there something that can be adopted with the capability to create simple programs without or with a minimum of code? Considering that, no-code platforms are gaining more and more popularity now. What do they look like now, what will they look like in the future, what hinders their development and why can't we refuse the services of developers? I tried to answer the questions below.

What is no-code

When robots become intelligent, their money will be called kilowatts.

No-code nowadays

In fact, no-code is now nothing more than a constructor. There are components, they are linked using settings. The logic of the application is created using code (such platforms are called low-code) or drawn in the form of graphical diagrams (no-code). This topic is not new. Let’s remember at least Delphi: by applying a few components to the form, you can create a rather complex application. You can create a website, chatbot, document management system, ERP, and much more in the same way. Constructors for games look somewhat different, but they still consist of an editor and logic. Examples of the constructors are Unity3D, Adobe Flex, and Unreal Engine. There are also accounting systems: 1C, SAP, and so on. I see no reason why one cannot come up with a system for any other type of human activity. Question: does the current state of no-cone systems threatens the profession of a programmer? The answer is no. Moreover, ABAP (Input Language for SAP) programmers are considered to be among the highest-paid.

And no-code in the future

Astrolabe ... measures by itself, provided you have something to measure ©

Ilf and Petrov. Twelve Chairs

As I indicated above, at the moment, no-code platforms are not a threat to the workplaces of IT specialists. But, let's say, over time, artificial intelligence will develop. It will be able, for example, to create programs based on a text description and a drawing by hand. Will this be the end of high-paying IT jobs and the job seeker's labor market? Let's figure it out. First, how is drawing fundamentally different from dragging and dropping controls onto a form? The only difference is that for the former you need to be able to draw with a mouse or with a stylus. Secondly, the free form of textual description will be limited because it should describe the algorithm of the program's operation. Yes, there are already experimental tools that allow you to convert natural language into code, but even in a natural language, you need to clearly describe what the program will do. It is quite possible that knowledge of modern programming languages ​​will become a thing of the past, as has already happened with Assembler, but the need to describe algorithms will not go anywhere in the foreseeable future. It is the capabilities of a person, not artificial intelligence, that stand in the way of progress. People simply do not know how to algorithmize. And as you may think, the algorithm is far from just clever problems at the Olympiads. See for yourself by asking your family members to write an algorithm for making coffee by writing it down in words. Granted, that not everyone will succeed on the first try. On the other hand, Lisp has been able for over half a century to create DSLs that are virtually indistinguishable from a natural language. It should be noted that progress in the development of the tools by no means leads to a decrease in the number of programmers. It is in fact the opposite: every year there are more computerization problems than enough people who know how to solve them. And there is no one left who is willing to code in exchange for "reasonable money". And the requirements to developers are only growing: in the early 90s, knowledge of a programming language was enough to work, then the knowledge of relational databases was needed, then programming web applications, and so on. Mobile platforms, frontend, artificial intelligence were added to this list - everything without which modern IT is unthinkable. But what if you really, really don't want to write code? Is it possible? It turns out, it is possible, because there are...



Flowchart, flowcharts everywhere

If the logic cannot be written, it must be drawn, and, as a rule, flowcharts are used for this. According to Wikipedia, a flowchart is nothing more than a common type of diagram (graphical model) describing algorithms or processes in which individual steps are depicted as blocks of various shapes, connected by lines indicating the direction of the sequence. In other words, a flowchart is a set of shapes connected by lines with arrows. There may be something written inside the shapes and on the arrows. It seems to be nice, but the devil is in the details. They limit the application of the flowcharts to boring laboratory works during your studying.

Reasons behind the limited use of flowcharts

Let's take a closer look at the disadvantages of flowcharts. We will use an online editor as an illustration.

Lack of mandatory structure

Flowcharts can be drawn in any way: even from right to left, even from top to bottom, even obliquely. No connection with the timeline, nor with the flow of events. No wonder they are called "spaghetti". It is almost impossible to understand these Inca writings.

The standard allows the intersection of lines without semantic content, even placing figures on top of others: you can draw an indecent word with a flowchart and it will be quite valid. As an illustration, the figures above are flowcharts. The figures and connecting lines represent the letters "F", "U", and “C”. The fourth letter is left as an exercise for the reader, in accordance with the measure of his licentiousness.

Lots of empty space



Let's see what a block diagram of a simple "for" loop looks like (picture below):

At the same time, in the C language, this block diagram looks like this:



Is the block diagram clearer? No! Smaller? No! Why it should be used then?

Redundant complexity

See how many shapes are offered for use in the popular online editor www.lucidchart.com



For each of them, there are rules of use described in hundreds of textbooks, some of which also contradict each other. It is impossible to understand all this without reading a few books. On the other hand, after reading several books on the programming language, you can already start writing code. At the same time, learning only the flowcharts will not make you able to create programs.

As a result, professional programmers usually do not use block diagrams. Is there anything you can do about it? Yes. The disadvantages can be overcome by introducing standards, restricting creative freedom in such a way that only compact, clear and understandable schemes will emerge from under the mouse or stylus. And such standards were developed back in the USSR. By the way, nothing better has been invented anywhere for the past thirty years, although there were some attempts. One of these standards is R-charts notation.

Introduction to R-charts

The R-chart notation was developed in the USSR by Igor Vyacheslavovich Velbitsky, Doctor of Physics and Mathematics, at the Kyiv Institute of Cybernetics of the National Academy of Sciences of Ukraine back in 1975, even before the birth of the author of this article. Yes, with its help programs for missiles targeted at the evil bourgeoisie were created. But it did not work out, since the USSR sank into oblivion, leaving us a legacy of the R-technology (and much more). Firstly, this language is graphic, and secondly, very simple, but this is only at first glance.

It has:

points, that contain no text;

lines that connect the points, which can be horizontal or vertical. You can place text on the top and bottom of these lines.

This is enough to create programs of any complexity.

From the theoretical point of view, R-charts are a directed graph that is loaded along arcs, which means that labels can only be on them, not on the tops. This notation is dictated by considerations of compactness: there is much more space on the connecting lines than inside the points.

The simplest program

Here is the simplest program describing the behavior of a hungry person, whose actions depends on the available sum of money:

As you can see, the condition is written at the top and the action at the bottom.

Program with transition

Suppose someone went to the store to buy bread. If there is no bread, it doesn’t matter – there should be some in the next one. The R-Chart describing this process is shown below.


This is analogous to jumping to a line of code. Or at to the fork in this case. Some of the arrows do not have inscriptions above, below, or at all, which is normal. In this case, it means an unconditional action, a jump on a condition, or an unconditional jump.

Looped program

Is it possible in the previous case to make a chart without drawing an arrow following to the beginning? Yes, it is possible by using a loop:


See the number sign? It means that this arc represents a cycle. But there can be more than one action in a cycle. In this case, the R-chart will look like this:


At the top of the arc marked with a cycle, we write a condition. The actions written on the arcs below it are repeated.

That's all the theory that should be mentioned. Below I will develop the idea of ​​R-charts in various applications to real-life problems.

Advantages over block diagrams

How R-charts are different from dozens of UML block diagram implementations? Let's figure it out.

Clear rules of construction and simplicity

R-charts consist only of vertical and horizontal lines. This makes it easier to read.

Compactness

R-diagrams are loaded only along arcs, where there is a lot of space for inscriptions, they can be used for programming from a small screen of mobile phones.

As an example, let's see how the for loop from the example at the beginning of this article would look like:



And that is it. It certainly takes less place than C code representation.

Using R-charts for No-Code Platforms

R-charts are a good tool for declarative programming. It is applicable wherever it is necessary to separate the algorithm itself from the implementation of technical details, that is, what all no-code platforms have been created for. Let's see how this technology can be applied to no-code.

Chatbots

There are literally hundreds of platforms for the creation of chatbots. Typically they are combination of flowchart designer with settings. Below is a screenshot from the Landbot service. It shows that even a small chat created for testing does not fit on the screen:



Let's see how the same chat can be made with an R-chart:



As you can see, the circuit is much more compact. At the top, we write the type of the element and its specific parameters at the bottom. For example, if you need to display a message at the top of the line, we write "message", and its text at the bottom. In the case of a choice of options, write “Select” at the top and under this line the options for selection. Everything is very simple.

Gaming Platforms

Is it possible to create a simple game without code? Yes! The flowlab platform can fulfill this task. This is a tool that can be used for creating 2D platformers. In it and in other similar platforms there are game objects that have the following characteristics:

Object type: floor, wall, robot, bush, character, and so on.

Physical characteristics: coordinates, speed, mass.

Behavior that depends on the physical characteristics of a particular object at a given time and the game scenario.

The toolkit for creating games, therefore, consists of two editors: a graphical one for sprites and an editor for flowcharts. With the help of the latter, the behavior of the characters is created. However, in existing systems, the implementation of flowcharts is extremely imperfect and ...

And this is ... our favorite block diagrams with their shortcomings, which can be avoided by the introduction of R-charts.

Let's see how you can program the behavior of a spaceship in a scroller. The spaceship flies across the screen from top to bottom (in fact, it is stationary relative to the computer screen - the game world is moving). The spaceship shoots if you press the spacebar. If the spaceship hits an obstacle, it explodes. Left and right movements across the screen are made by pressing the "A" or "D" keys.



Actually, that's all. Those of you who have ever written games using, say, Adobe Flash or Unity, know how much code it takes to create the aforementioned logic. Spoiler for those who didn't - a lot of code!

Robot software

The future has already become a reality, robots have already come into our lives. They appeared in industries long before the birth of the author. For example, you can create a drawing of detail in AutoCAD, then transfer it to a CNC machine, and the detail will be created without human intervention. But let's look at an example closer to a mere mortal. Suppose we have a coffee maker and it brews the coffee at a certain time on weekdays. On holidays the set time is different. If the day is marked as a vacation on the calendar, the coffee maker will be inactive. Let's see how this program will look in «R».



As you can see, everything is so simple that it causes some feeling of neglect. But this feeling is justified because such a program can be written by any housewife.

So what's next?

The author in his spare time develops a constructor that allows using the R language for a variety of applications. Development languages are TypeScript 2 + React.

Little has been done so far due to the full-time job and non-work activities. The current schedule leaves out the possibility to spend more time on the project. Therefore enthusiasts are invited for cooperation. This is not a startup yet – rather an open-source development, but I plan to participate and win the grant. The application for a grant is in an active phase.

p.s. Follow the link for my interview about no-code platforms to Taras Luxurious, Vice President of the IT Guild.