Stupid Question 71: What is a scripting language?
what is a scripting language
I thought I knew the answer to this one, but once I was asked I realized that I couldn’t quite explain.
What is a scripting language? Wikipedia offers, as always, and extensive explanation – while in the forums developers and alike disagree with the article or at least parts of it.
There is script, and there is script. I’m sure that a little PowerShell script (or big ones, since I’m just getting started with PowerShell my scripts are still small ;) ) is not quite the same thing as writing up a program in a scripting language. So for me there is a distinction there, shell scripts versus program scripts. I’ve read somewhere that intended use for script languages was to modify the behavior of a program, rather than actually create the whole program in that language. Scripts used to be interpreted in contrast to programs that were compiled, but both these things have changed and therefore there isn’t any more a clear definition of what a scripting language is.
I say ‘used to’ as I started out as a C# developer and I haven’t worked much with scripting languages, so I can only summarize my impression from whatever I have read. But it is very interesting to read those discussions ‘from the outside’- because I see only languages and don’t quite get what the fuss is about :D
With that I also have a sub-question, what’s up with the language snobbery? I’m under the impression that script languages (which I’m unable to define) are worse or limiting,- and not ‘real’ programming. Might be that I’m just a new kid on the block and have missed out on something here, but aren’t they all just programming languages?- and how great they are will depend quite heavily on the intended usage and the skills and understanding of the author? Wikipedia says that it is a subset of a programming language – is that accurate if it can’t be defined?
Some links (discussions):
What is the main difference between Scripting Languages and Programming Languages?
When is a language considered a scripting language?
What’s the difference between a “script” and an “application”?
Comments
I hate these questions, they're always so open to pretty much any answer! If I had to say, a script is a task or a number of tasks, which includes the authority of these tasks to allow them to serve a function or assist or alter an existing process somewhere. What makes a script is dependent on what you want to do - change the way something works, as in add a feature or use it as a base system that feeds you, or obviously construct the whole thing I think it falls down to the project/what you want to accomplish and your methodology behind achieving that - look at what you want to do without thinking about scripts/languages - understanding the methods, thought, time available and patterns you need to follow to accomplish it and then select a language or try a few and see how it develops with each. I always think the sign of a decent natural developer is if they have knowledge of more than a single scripting language. Questions like are difficult for anyone to answer so it's easier to show it! It's easy to become reliant upon what you know best but you can end up obsessed by a single language and get lazy by using what only your brain knows best, which limits yourself as you forget the basic fundamentals that they can all share and can really benefit each other with.
A script language doesn't need to be compiled (by the person writing the script) in order to run. All non-script languages must be compiled before they can be executed.
Well, naturally, a scripting language is one designed to write scripts. So, what's a script? I would define that as a *short* piece of code intended to handle a simple, task -- often for one-time use. So a scripting language would emphasize features that promote those goals rather that long-term maintainability. For example, scripting languages are generally interpreted rather than compiled. Also, they usually use simple "can be anything" variable types rather than requiring that they be predefined as a specific data type.
If you go back to the old days (say IBM 360/370 type machines), you had a thing called JCL (Job Control Language). JCL contained statements to (say) (1) load a program "PROG01" from disk, (2) set aside 32K for the program, (3) run the program etc. The program "PROG01" was compiled using maybe COBOL or FORTRAN or PL/1 or whatever. So the JCL was like a very limited interpreter to call up and run the compiled programs. I think scripting languages are an evolution of the old JCL type instructions. They've added much more stuff along the way; become much more comprehensive; added modern programming language constructs; taken account of the internet; got the ability to be compiled (sometimes) and eventually evolved into what we have today. Maybe the distinction is not relevant anymore. It might have been better if evolution (of programming languages) had taken a different turn and we had less confusion and less syntax and grammar to learn?
Generally speaking, the main difference is that a scripting language is typically interpreted, not compiled like C++. Some people get into language snobbery, but every language has its purpose. I'll admit that I used to be a bit of a snob many years ago, but changed my ways. Even though most of my work is in C++ and C#, I will utilize whatever tool is better for the job at hand, whether it's Perl, PHP, Python, etc. There are some tasks that are too hard to implement quickly in C++ that you can easily put together in a scripting language.
On the surface, the idea of a scripting language is that it is both able to run without compilation, and that it can act as a bridge between standalone programs to accomplish something that the standalone programs can't do themselves. With the advent of more powerful scripting languages and their ability to do so many things, and to do them at a level very similar to their compiled counterparts. Take Ruby and C. One can argue that you can do an awful lot of the same things with both languages. the main difference is that, with a C compiler and some preprocessing commands, I can make an executable that will run on any platform if I so choose. While I can make a Ruby program that can do arguably 99% of what the C program can do, I will always need to have a Ruby interpreter on the platform I choose to run my Ruby program. thus, for me. that is the big distinction. Regarding snobbery, I think it's great if you can develop a deep level of knowledge for a particular language. Those skills are hard won and well earned. Different people and organizations have different needs based on making different choices. If i want to develop an iPhone app, I better learn some Objective C. If i want to program on a Rails site, it's a good bet I better learn how to use Ruby. Still, given a short window of time and a need to get something done quick, my scripting language of choice is the UNIX operating system and bash :).
Last modified on 2012-10-31