In the beginning
In the early times of computing, you had a huge computer which would run so called “jobs” . People who wanted to run their program needed to create a program, put it on the computer and it would run overnight. Each program was queued as a job and they would execute one after another. When your job was done you got the result. In the really early days the result was printed, but the time I am targeting at the result was written on a tape and could be requested at a later time, but it would be overridden or swapped out at some point.
You might imagine that this was quite tedious for people who wanted multiple tries with their program, or who wanted to feed the output of one program into an other. Therefore a small interpreter language was created to allow the programmers more control over their jobs. This allowed the programmer to specify his job, which could contain multiple programs and manipulate the input and output of his programs. This was actually the first usage of a script like syntax within a computer. The language was created and used by IBM, and was used on their mainframes.
So what is the difference between a script language and a programming language anyway? Well a script language runs within an execution environment and can only execute functions created by themselves or handed to them by the execution environment. This means that all interaction with the underlying operating system is through the execution environment.
Knowing this you probably guessed that allot of modern “programming languages” are actually script languages with a huge environment sitting on top of it. For instance: Python, PHP, Ruby, Perl.
But yeah… With python you can do a whole lot more than just control the flow of a process. Moreover with these languages you actually think that you have direct access to the OS with some function calls. But the hard truth is: You don’t.
This is why I think, that the original usage of scripts are underrated nowadays. Huge projects are created and have so little control and yet, it is so easy to implement some form of control via script languages.
The only 2 big usages of scripts are within the game industries and within web development. Within the game industry it is quite common to use script languages. I know that within most game engines you can script some behaviour of objects and manipulate them.
But there is so much more to it. The first time I used it, I was amazed by the possibilities. For instance what if you have a standardized way of saving data but the layout and / or sources from which you get data differ. You could write code for all the sources and keep on adding source code. This is fine at first, but with four sources you should really be starting to eel dirty and realize that there has to be a better way. A good way to do it, is to take all the data from a specific source, throw it to a script which is specific for that source, take the output and store that. Now the only thing you have to do is edit / add some scripts files and let them output the data in a standardized way.
With languages which don’t compile into one source file this will look like a hassle. But it also keeps things separated and since scripts are easy to make (most of the time), other people can make them as well.
In my next post I will give some code examples of scripts which run within your programs.