📜 ⬆️ ⬇️

Concept of life program

How can you define the concept of life of the program? The life of a program can be described by a repeating sequence of finite processes in a computer performed in the context of the chosen subject area. Mandatory finite, in some reasonable time interval.


design


When does the program appear? Most likely, the program appears in the head of the designer / developer, you can call this design-time . But since this moment cannot be controlled by the computer (for the time being), let us assume that the moment of the program's appearance is the moment of the creation of the minimum launching (the detailed meaning of this term should be discussed separately) of the source code.


In the context of modular languages ​​or languages ​​with OOP, a program is born when a minimum module / class appears. We will carry out further consideration for modular systems, since in non-modular / script systems, certain stages are usually reduced / molded into a single stage.


You can reasonably select a design-time in a separate category, but not as a process in the developer’s head, but as a purely utilitarian, based on the coding process. Here you can describe autocompet, auto-backlight (as already implemented programs), programming of ide macros, generation of DB and DRAGON schemes, and so on.


compile


Then, after writing some program code, the program is passed to the compiler. The compiler provides so-called. compile-time - compile time . As a result of the compilation process, we get a compilation (that is, the direct result of processing our source code).


During compilation, our source code affects the operation of the compiler according to certain laws, which are expressed in the compiler code.


At the same time, no one interferes at the compilation stage to control the actions of the compiler (more precisely, the performer as a whole) not indirectly, through writing the text of our program, but directly, through writing the general-purpose code that will be executed by the compiler .


That is, such code, which, although it belongs to the conceived program, is not translated by the compiler into the compiler directly. The so-called CTFE , but more generally. It is clear that finding a compiler in the context of the process may impose some restrictions on the compile-time code , but it may not.


Here we can see that the execution of any process of the life cycle implies the existence of a result, either explicitly or implicitly.


load


After the compilation is obtained, the binding or linking process should be performed on it immediately or deferred. Since the compiler is usually stored in a file, load time occurs - load-time .


At this time, additional conversions to the target platform code can be performed on the compiler, and at this time, load time code can be executed, for example, compiler processing by the optimizing compiler.


Currently, only one technology is known, WebAssembly ( slim-binaries ), late code generation on the target platform, which at least describes the load time.



Normally, linking is necessary, as the compiler always produces a compile for one module for direct execution on the target machine. However, in a real modular system, several modules will be executed simultaneously on the machine.


This situation in a multi-module system makes binding necessary. In older systems, the binding could take place immediately after compilation, but we do not consider this degenerate case. So, there is a binding time , or link-time .


Little is known about code execution during binding, however, it is clear that at the time of binding, it is possible to execute code, for example, Dependency Injection and dynamic inheritance / proxying, as this can be implemented as part of the jvm operation.


Such control over the program code that is not yet launched into action, but which is already ready for execution, makes it possible to implement automated tuning and so on. After linking and configuration, the code is immediately ready to run.


init, run, close


Launch and further work. The most famous stages of the general public. Represented by initialization time ( init-time ) and runtime ( run-time ). In essence, the result of the work of this stage of the life cycle is usually the immediate goal of writing a program.


You can additionally highlight the time of the program's work ( close-time ) However, now all three working hours are usually called run-time , and the logical division into three stages is implemented within the framework of the client program code.


This approach reduces the requirements for the run-time environment but does not guarantee the execution of a particular stage in the desired sequence due to possible run-time errors after which the execution usually has to terminate abnormally.


death


A separate important lifetime of the program is the death-time ( death-time ), in which, contrary to popular belief, it is also part of the program life cycle. The explanation here is simple, since the goal of the program is usually a certain result, usually dependent on input data, of which there can be a lot, the programs are built using methods that allow iteratively processing the input data and producing output data that can be input to the next iteration .


Typically, such data is structured (DB), versioned (the result of interaction with a third-party API) and its content and interpretation depends on the implementation of the running program. That is, the program is the algorithms and data, including external and the degree of coherence of these external data with the program does not affect the fact of such coherence at any stage of the life cycle.


Simply put, the program launched again will work in different ways, depending on the result that was obtained by it at the last stage of the life cycle. And if you make changes to these data during a time that the program is not running, the program will also work differently, that is, by making changes to the data, we program the program to work differently. What is the stage of the program life cycle.


Results


So, the stages of the program life are considered: design-time -> compile-time -> load-time -> link-time -> init-time -> run-time -> close-time -> death-time . As you can see, all the steps are present in the development and use cycle of any program, which means that in any of these steps, custom code can be executed that will allow you to get the result that most closely matches the goals of the developer. To date, there is no such language, framework or ecosystem in which these stages would be implemented in its entirety. Science, business and the community have much to strive for.


')

Source: https://habr.com/ru/post/313934/


All Articles