Why the concept of bytecode is not as relevant as it was before
Compiled languages of the interpreted type are those programming languages that are compiled into some kind of intermediate representation (sometimes referred to as " bytecode "). The most striking example is the JVM (Java Virtual Machine).
This article sets out my thoughts about the concept of a virtual machine for programming languages in the current realities. In realities, where most services work on the Internet, and desktop programs are gradually being phased out.
Causes of occurrence
At the time the World Wide Web was born, Java technology appeared that first popularized the use of a virtual machine as a runtime environment for high-level programming languages.
Sun Microsystems tried to combine the reliability and high speed of compiled languages with portability and ease of use of interpreted ones. To some extent, the idea was realized, because Java still became the most common technology in building highly loaded servers.
Among other things, one of the main requirements of the platform was put forward, which later became the slogan - “Compile once, run everywhere!” . This meant that the programmer should only once compile the source code into the so-called bytecode, capable of running on any system where the JVM is installed.
This has become the driving force behind technology, throwing many languages into the background. This was a kind of revolution in the world of digital computing, because before anyone could not achieve a similar level of cross-platform. Now users could download the same version of the program on many operating systems and processor architectures, and be sure that it would certainly work exactly as the developers intended.
But times are changing, and technology with them. The World Wide Web is gaining more and more popularity, crowding out some things that are familiar to us.
The era of remote services
"Why deliver programs to users if you can just make a website?" - This question was asked by large entrepreneurs, which later resulted in large-scale emigration of services to the World Wide Web. Standard desktop programs have begun to lose their popularity, because it is much easier and more efficient to make a simple (or not so) website.
Consequently, the need to download programs from the Internet so often has disappeared. Open a site and take the necessary actions much faster than downloading megabytes of binary data.
Meanwhile, Java has gained popularity in building those very sites, because nothing more convenient at that time (to this day) did not exist. The source files began to be compiled only for a specific server architecture, therefore, the principle "Compile once, run everywhere!" ceased to have its former meaning . Users stopped downloading programs, and developers began to compile only for a specific architecture.
Previously, compiled programming languages had rather poor functionality of the standard library, because of which it was necessary to use a lot of platform-dependent functions even for a simple application that does not do anything supernatural.
Programming languages also did not stand still, and languages like Rust and Golang , both compiled, came to light , and both have a standard and many third-party libraries that provide functionality independent of architecture and operating system. In addition, the C / C ++ ecosystem also did not stand still.
As a result, it turned out that modern standard libraries and virtual machines perform the same role - they translate cross-platform code into platform-dependent functions.
The rest of
Some might argue that there is still a demand for desktop programs. Basically, these are closed programs intended for internal use in corporations, as well as a small number of publicly available applications.
In both cases, compiling for hundreds of different platforms does not make sense, since in the vast majority of cases only three well-known operating systems ( GNU / Linux , Microsoft Windows and Mac OS ) and one family of processor architectures ( x86 ) are used.
In total, we have virtual machines slowing down their work (as bytecode runtimes), which have lost their main advantages due to the two above factors:
- The need to run the program on hundreds of different architectures does not make sense, since most programs work on servers, and there are not so many user architectures and operating systems.
- Compiled languages did not stand still, and their standard libraries acquired the necessary basic functionality for cross-platform code.
Discussions in the comments are welcome, I hope that the article prompted you some thoughts about choosing the right language for your tasks.
As noted in the comments , managed code has some advantages that are not available to the compiled code, including reflection and annotations.