Today: November 15, 2024 6:11 am
Syntax code summary - memorize and review previously learned code faster
Your menu is empty or not selected! How to config a menu

Generations of programming languages

It seems to look rather imperative: we describe specifically how we achieve some result, we explain to the machine in its language, byte by byte. In fact, there is a mistake: this is a subtraction operation, and we need addition. The third character in the second line must be zero. In this case, it is very difficult to understand what is happening, very low level of abstraction. Therefore, the guys came up with the second generation of languages.

Assembly language is extremely declarative compared to the previous language because it has an ADD operation. You are not describing how to explain it to the machine, you are telling what to do – to fold. But, as it turned out, this is also not enough.

The guys came up with high-level languages: Java, Kotlin, C, C ++. They are also very declarative in comparison with previous generations, because you do not explain to the machine what to put, but simply say: a = 4, b = –2 and result = a + b. But all this is past.

And today we are already talking about higher languages: these are things like RxJava or declarative UI frameworks. New declarative frameworks do not bring anything new from the point of view of the general concept. They, like all other generations, abstracts the previous generation, that is, the fourth abstracts the third, the third abstracts the second, and the second abstracts the first.

Obviously, any new generation, compared to the previous one, is easier to use for more complex tasks. Our problems are evolving, and we need to solve them easier. When new problems arise, we come up with new abstractions, new generations that solve them more efficiently. Examples of the fourth generation include 1C, R, SQL, RegEx. Even in the fourth generation, there are domain specific languages, that is, small frameworks that solve specific problems: React, RxJava, JetpackCompose.

Conclusion: declarativeness is almost always based on imperativeness. Someone has to explain to a machine, a previous generation, or a framework how to do it so that we just say what. Another confirmation of this fact is that in any declarative framework there is almost always an opportunity to escape into the imperative.

For example, C ++ has intrinsics or inline ASM. In React, we can get references directly to DOM elements or control the lifecycle. A great example in RxJava is PublishSubject. Jetpack Compose has imperative drawing, imperative touch-handling, onCommit. This gives you more control, as well as the ability to build your declarative abstractions on top of the imperative.

0 Comments

No Comment.

Hello there :)

Subscribe to our newsletter!