views:

480

answers:

9

Hi, I like to know difference between script and a program. Most of the time I hear script is running , is that not a program.I am bit puzzled.Can anybody elaborate on this?

Thanks

+1  A: 

Scripts are usually interpreted (by another executable).

A program is usually a standalone compiled executable in its own right (although it might have library dependencies), consisting of machine code or byte codes (for just-in-time compiled programs)

Mitch Wheat
+1  A: 

See:

The Difference Between a Program and a Script

Script is also a program but without clothes, you can see through that (source code) whereas a program is one having clothes, you can't see it's source code unless it is decompilable.

Script need other programs to execute them while programs don't need one.

Sarfraz
A: 

A framework or other similar schema will run/interpret a script to do a task. A program is compiled and run by a machine to do a task

Matt
A: 

IMO Script - is the kind of instruction that program supposed to run Program - is kind of instruction that hardware supposed to run

Though i guess .NET/JAVA byte codes are scripts by this definition

+3  A: 

For me, the main difference is that a script is interpreted, while a program is executed (i.e. the source is first compiled, and the result of that compilation is exected).


Wikipedia seems to agree with me on this :

Script :

"Scripts" are distinct from the core code of the application, which is usually written in a different language, and are often created or at least modified by the end-user.
Scripts are often interpreted from source code or bytecode, whereas the applications they control are traditionally compiled to native machine code.

Program :

The program has an executable form that the computer can use directly to execute the instructions.
The same program in its human-readable source code form, from which executable programs are derived (e.g., compiled)

Pascal MARTIN
+3  A: 

Typically, a script is a lightweight, quickly constructed, possibly single-use tool. It's usually interpreted, not compiled. Python and bash are examples of languages used to build scripts.

A program is constructed in a compiled language, like C or C++, and usually runs more quickly than a script for that reason. Larger tools are often written as "programs" rather than scripts - smaller tools are more easily developed as scripts, but scripts can get unwieldy as they get larger. Application and system languages (those used to build programs/applications) have tools to make that growth easier to manage.

You can usually view a script in a text editor to see what it does. You can't do that with an executable program - the latter's instructions have been compiled into bytecode or machine language that makes it very difficult for humans to understand, without specialized tools.

Note the number of "oftens" and "usuallys" above - the terms are nebulous, and cross over sometimes.

Michael Petrotta
A: 

There are really two dimensions to the scripting vs program reality:

  1. Is the language powerful enough, particularly with string operations, to compete with a macro processor like the posix shell and particularly bash? If it isn't better than bash for running some function there isn't much point in using it.

  2. Is the language convenient and quickly started? Java, Scala, JRuby, Closure and Groovy are all powerful languages, but Java requires a lot of boilerplate and the JVM they all require just takes too long to start up.

OTOH, Perl, Python, and Ruby all start up quickly and have powerful string handling (and pretty much everything-else-handling) operations, so they tend to occupy the sometimes-disparaged-but-not-easily-encroached-upon "scripting" world. It turns out they do well at running entire traditional programs as well.

Left in limbo are languages like Javascript, which aren't used for scripting but potentially could be.

DigitalRoss
+1  A: 

I take a different view.

A "script" is code that acts upon some system in an external or independent manner and can be removed or disabled without disabling the system itself.

A "program" is code that constitutes a system. The program's code may be written in a modular manner, with good separation of concerns, but the code is fundamentally internal to, and a dependency of, the system itself.

Scripts are often interpreted, but not always. Programs are often compiled, but not always.

Enigmativity
A: 

According to my perspective the main difference between the Script & Programe :-

Scripts can be use with the other technologies as well. For eg.PHP scripts,Java scripts etc. can be use into the HTML. Whereas Program is a stand alone chunk of code that can never be embed into the other technologies.

If I am wrong at any place please correct me.I will admire your correction.

Thanks & Regards Karan Gupta India

Karan Gupta