As a student in Computer Engineering who has “a lot” of computer programming experience, and I say that lightly because I feel the more you learn, the more you find out how little you really know..
Whenever I create a program, whether it be in Java (game engine/games), C (or any C variant) (applications), PHP (online scripting/database programs), Javascript (UI), etc.. I’ve never
fully understood what “installing” a program does, and i’ve never had the need to do it.
From previous research, I learned that installing a program writes to the registry, but why is this complex process necessary? What actually happens when a program is installed? Why do this when you can just create an executable file (.exe in C / .jar file in java)?
When it comes to scripting languages (I mostly know php, so i’ll stick with that example). I hear “installing a script”, or “installing a plugin”. In reality, isn’t installing a script just copying a group of folders with scripts/html forms/javascript/etc into a server?
I would appreciate any explanation, any links and any personal knowledge about the subject or any similar topic. I try to learn as much as possible, but there’s always more.
To give a very general answer: installation is the procedure that makes sure that a program is fully set up to execute. (There’s even a Wikipedia page which uses somewhat the same definition). I’m not going to try to give a complete and accurate summary of all installation types, but only attempt to generate a general overview.
In the end everything is controlled by cpu commands. To get there, translations need to be done.
Besides that, in normal circumstances, there’s an encapsulating environment (the OS).
And between those, you could have dependencies on drivers etc.
The OS, be it windows/Unix/etc is there for us so we don’t have to worry about any direct hardware steering (for this scenario anyway)
So giving a random programming language or script, we need to get it to run at the OS.
Either directly on the OS, or via a framework such as .Net/Java (Apache for PHP)
Thus far the known summary, but just so we’ve set the parameters for the kind of installation we’re talking about here 🙂
In classic C, the language was compiled first to a set of instructions that could be interpreted by the OS. So as you say, no installation was needed, only a precompilation.
In Java/.Net, a framework already is installed, so the compiled intermediate language and all references are handled by the framework.
Browser languagues such as Javascript are interpreted in the browser. The browser itself is already installed, so no install needed.
PHP script is also interpreted. Most of the time by Apache, but no separate install is needed.
And of course other scripting languages such as batches/vbscript/etc all have their own OS interpreters.
Now to get the point that triggered me when reading about writing to the registry, is mentioning the da da da dum DLL Hell . The linked wikipedia page describes the problems which were encountered with dlls, but I mainly want to mention it as a bridge to the registry writing. One of the most common cases why installations need to write to the registry, is to register a dll. You couldn’t simply have a set of executions (.exe), that used a bunch of functions from another set (.dll), unless that other set (.dll) was known by the OS. To make the dll known and usable, it needed to be registered. This could be done via the command prompt (regsrv32 if I remember correctly), but for the end user, the installation program would handle this.
Bottom line is, the installation program, prepares the environment so the program can run. Even if the program could technically run without extra preparation, the installation program can set desktop shortcuts, add menu options or link file types (another registry setting in windows).