Understanding Compiled versus Interpreted Programming
Compiled programming consists of writing program code in a text editor, and then using a compiler to convert the text file into an executable binary file. Once that’s done, users of the program won’t be able to easily view the source code of the program. With interpreted programming, the program runs directly from a text file, without having to compile it first.
Compiled programming languages, such as C, C++, or Fortran, are good for when you need maximum performance from your programs. However, they can be fairly hard to learn, especially when it comes to the lower-level functions such as working with files. Interpreted languages might not offer quite as high a level of performance, but they are generally quite flexible, and generally easier to learn. Interpreted languages in general also offer a higher degree of portability between different operating systems. Shell scripting falls into the category of interpreted languages.
Here are some reasons why you might consider using an interpreted language:
- When you are looking for a simple solution.
- When you need a solution that is portable. If you pay attention to portability concerns, you can write one script that will work on different Linux distros, as well as on Unix/Unix-like systems. That can come in handy if you’re working in a large corporation with a large network of mixed operating systems. (You might even find some larger corporations that are still running legacy Unix systems, such as AIX, HPUX, or SUNOS, alongside more modern implementations of Linux, BSD, or macOS.)
And, here are some reasons why you might consider using a compiled language:
- When the tasks require intensive use of system resources. This is especially true when speed is extremely important.
- When you are using math operations that require heavy number crunching.
- When you need complex applications.
- When your application has many sub-components with dependencies.
- When you want to create proprietary applications, and prevent users from viewing the application source code.
When you think about it, pretty much every example of productivity, server, gaming, or scientific software falls into one or more of these categories, which means that they really should be built with compiled languages for best performance.
Okay, let’s now talk about sudo
.