Search code examples
programming-languagesscripting

What is difference between scripting languages and other languages


Possible Duplicate:
When is a language considered a scripting language?

I am really confused between different types of languages. Can any one guide what are diff types of languages or diff categories.

Like some saying python is scripting langauge. Now what does that mean. Are other langueages like php , asp , java not scripting langauges


Solution

  • The name "Scripting language" applies to a very specific role: the language which you write commands to send to an existing software application. (like a traditional tv or movie "script")

    For example, once upon a time, HTML web pages were boring. They were always static. Then one day, Netscape thought, "Hey, what if we let the browser read and act on little commands in the page?" And like that, Javascript was formed.

    A simple javascript command is the alert() command, which instructs/commands the browser (a software app) that is reading the webpage to display an alert.

    Now, does alert() related, in any way, to the C++ or whatever code language that the browser actually uses to display the alert? Of course not. Someone who writes "alert()" on an .html page has no understanding of how the browser actually displays the alert. He's just writing a command that the browser will interpret.

    Let's see the simple javascript code

    <script>
    var x = 4
    alert(x)
    </script>
    

    These are instructs that are sent to the browser, for the browser to interpret in itself. The programming language that the browser goes through to actually set a variable to 4, and put that in an alert...it is completely unrelated to javascript.

    We call that last series of commands a "script" (which is why it is enclosed in <script> tags). Just by the definition of "script", in the traditional sense: A series of instructions and commands sent to the actors. Everyone knows that a screenplay (a movie script), for example, is a script.

    The screenplay (script) is not the actors, or the camera, or the special effects. The screenplay just tells them what to do.

    Now, what is a scripting language, exactly?

    There are a lot of programming languages that are like different tools in a toolbox; some languages were designed specifically to be used as scripts.

    Javasript is an obvious example; there are very few applications of Javascript that do not fall within the realm of scripting.

    ActionScript (the language for Flash animations) and its derivatives are scripting languages, in that they simply issue commands to the Flash player/interpreter. Sure, there are abstractions such as Object-Oriented programming, but all that is simply a means to the end: send commands to the flash player.

    Python and Ruby are commonly also used as scripting languages. For example, I once worked for a company that used Ruby to script commands to send to a browser that were along the lines of, "go to this site, click this link..." to do some basic automated testing. I was not a "Software Developer" by any means, at that job. I just wrote scripts that sent commands to the computer to send commands to the browser.

    Because of their nature, scripting languages are rarely 'compiled' -- that is, translated into machine code, and read directly by the computer.

    Even GUI applications created from Python and Ruby are scripts sent to an API written in C++ or C. It tells the C app what to do.

    There is a line of vagueness, of course. Why can't you say that Machine Language/C are scripting languages, because they are scripts that the computer uses to interface with the basic motherboard/graphics cards/chips?

    There are some lines we can draw to clarify:

    1. When you can write a scripting language and run it without "compiling", it's more of a direct-script sort of thing. For example, you don't need to do anything with a screenplay in order to tell the actors what to do with it. It's already there, used, as-is. For this reason, we will exclude compiled languages from being called scripting languages, even though they can be used for scripting purposes in some occasions.

    2. Scripting language implies commands sent to a complex software application; that's the whole reason we write scripts in the first place -- so you don't need to know the complexities of how the software works to send commands to it. So, scripting languages tend to be languages that send (relatively) simple commands to complex software applications...in this case, machine language and assembly code don't cut it.