I have a friend who programs in .Net (I referred to him in a prior post). We’ll call him “Trevor.”
Trevor and I have epic arguments about the superiority of our chosen platforms. I use open-source, “scripting” languages – PHP and Ruby, mainly – while Trevor develops in .Net.
Trevor has the habit of calling me a “[blank] scripter.” Usually the blank is filled with “crappy” or something else unprintable – he’s entertaining if nothing else.
However, this running argument got me thinking about what makes something a “scripting” language, and not a “programming” language. I’m sure this is not an original question, but I nevertheless came up with what I think are the two key differences:
Strongly vs Weakly-Typed “Scripting” languages are usually weakly-typed, meaning anything can fit into any variable. “Programming” languages are strongly-typed, meaning you have to declare what a variable can hold before you put something in it.
Compiled vs. Interpreted “Scripting” languages exist in source, which is compiled to machine code at runtime, which involves an extra step and is therefore slower. “Programming” languages are pre-compiled.
Put another way, if PHP was strongly-typed and pre-compiled, would it be considered a “programming” language, rather than a “scripting” language? Could I then tell Trevor to bite me?
Where is the line? I’m interested in opinions. I’m sure this question has been asked and answered before – can anyone point to some good resources on the subject?
In the process of looking at this, I found a great page on scripting at Wikipedia. Some quotes:
[...] it is usually faster to program in a scripting language, and script files are typically much smaller than, say, equivalent C program files. The flip side can be a performance penalty: scripting languages, often interpreted, may be significantly slower to execute and may consume more memory when running. In many relevant cases, however, e.g. with small scripts of some tens of lines, the write-time advantage far outweighs the run-time disadvantage. Also, this argument gets stronger with rising programmer salaries and falling hardware costs.
However, the boundary between scripting languages and regular programming languages tends to be vague, and is blurring ever more with the emergence of new languages and integrations in this fast-changing area. In some scripting languages, an experienced programmer can accomplish a good deal of optimization if they choose.