Site icon Automation Dojos

Interpreted Vs Compiled Languages

This is based on an excerpt from one of my favourite literature on VBScript and in fact, is quite relevant with respect to one of the earlier post – ‘Fundamentals and Concepts‘ posted under VBS tutorials.

Since we know that at some point, every language needs to be converted into machine-readable commands (binary) for the machine to understand and execute it, both the terms ‘compiled‘ and ‘interpreted‘ actually refer to this process only.

Compiled Languages

In the case of ‘compilation‘, the source code is almost ‘re-coded‘ into another language/form (binary) before distribution or deployment for the end-user. Hence after ‘compilation’ the end product of the source code remains no more human-readable but rather becomes only machine-readable and hence may require special tools to unpack or read it.

Moreover during the compilation process generally a good number of checks and verifications are performed which may verify the source code for syntax errors, dependencies (COM objects etc.), methods and properties of called libraries or COM servers, namespaces, and other resources. If everything goes fine, you get a packaged end product (example; ‘.exe’ file). All this happens even before a single line of code is actually executed by the end-user.

Interpreted Languages

However in case of the ‘Interpreted language‘, as is the case with our VBScript, the conversion into machine-readable commands actually does not take place until the ‘runtime’.

Hence the end product of the source code remains as a plain text file with the relevant extension (.vbs in our case). Now when this file is executed, the conversion into machine language takes place on-the-fly. This on-the-fly conversion process is performed by the relevant ‘Scripting Engine‘.Moreover this entire process of ‘Interpretation’ occurs logically in the memory and hence in no way alters your script source code which remains as it is. The syntax and other checks are performed in this case as well but again at ‘runtime’ only while the code is actually getting executed.

Runtime Compilation - Disadvantages

A couple of worth mentioning disadvantages which ‘runtime compilation’ brings along are :

  • Since the system has to exert more effort during runtime the performance is going to be slower in case of runtime compilation. But unless you are thousands of lines of code it should be pretty affordable.
  • Source Code security and protection is again one ‘grey area’ in case of runtime compilation. Since the end product is still a plain text file, it is prone to snooping and accidental changes.
  • Late discovery of bugs and errors is again a disadvantage. There can be a lot of syntax errors, misspelt variable or object names or even logic errors which you would be able to discover early in case of compiled languages but in case of runtime compilation these are not visible until the runtime.
Exit mobile version