A type of code suitable for reasoning by people (let it be called "source code") must go through several stages of translation before it can be physically executed using basic equipment (such as a processor or graphics processor):
- Source.
- [optional] intermediate code (for example, .NET MSIL or Java bytecode).
- Machine code corresponding to the target set architecture.
- The microcode that actually flips the logic gate in silicon.
These translations can be performed at different stages of the life cycle program. For example, a particular language or programming tool can choose a translation from 1 to 2 when the developer “builds” the program and translates it from 2 to 3 when the user “launches” it (which is usually done using software called “virtual machine” 1 which must be pre-installed on the user computer) This scenario is typical of "managed" languages ​​such as C # and Java.
Or it can translate from 1 to 3 directly during assembly, as is usual for native languages ​​such as C and C ++.
Translation between 3 and 4 is almost always done using the main equipment. This is technically part of the "runtime", but is usually distracted and largely invisible to the developer.
The term "compilation time" usually refers to a translation from 1 to 2 (or 3 ). There are certain checks that can be performed during compilation before the program actually runs, for example, make sure that the types of arguments passed to the method correspond to the declared types of method parameters (provided that the language is "strongly typed"). The sooner a bug is caught, the easier it is to fix it, but it must be balanced with flexibility, so some scripting languages ​​do not have comprehensive compile-time checks.
The term "lead time" usually means a translation from 2 (or 3 ) up to 4 . Even at runtime, it can be broadcast directly from 1 , as is done using the so-called "interpreted languages".
There are certain problems that cannot be caught at compile time, and you will have to use appropriate debugging methods (such as debuggers, logging, profilers, etc.) to identify them at runtime. A typical example of a run-time error is an attempt to access a collection item that does not exist there, which can then appear as an exception at runtime and is the result of a too complicated script execution for the compiler to “predict” at compile time.
"Debug time" is just the runtime, while the debugger is connected to the running program (or you are tracking the debug log, etc.).
1 Do not confuse this with virtual machines that are designed to run native code, such as VMware or Oracle VirtualBox.
Branko dimitrijevic
source share