Question

I'm referring to distinctions such as in this answer:

...bash isn't for writing applications it's for, well, scripting. So sure, your application might have some housekeeping scripts but don't go writing critical-business-logic.sh because another language is probably better for stuff like that.

As programmer who's worked in many languages, this seems to be C, Java and other compiled language snobbery. I'm not looking for reenforcement of my opinion or hand-wavy answers. Rather, I genuinely want to know what technical differences are being referred to.

(And I use C in my day job, so I'm not just being defensive.)

Was it helpful?

Solution

Traditionally a program is compiled and a script is interpreted, but that is not really important anymore. You can generate a compiled version of most scripts if you really want to, and other 'compiled' languages like Java are in fact interpreted (at the byte code level.)

A more modern definition might be that a program is intended to be used by a customer (perhaps an internal one) and thus should include documentation and support, while a script is primarily intended for the use of the author.

The web is an interesting counter example. We all enjoy looking things up with the Google search engine. The bulk of the code that goes into creating the 'database' it references is used only by its authors and maintainers. Does that make it a script?

OTHER TIPS

I would say that an application tends to be used interactively, where a script would run its course, suitable for batch work. I don't think it's a concrete distinction.

Usually, it is "script" versus "program".

I am with you that this distinction is mostly "compiled language snobbery", or to quote Larry Wall and take the other side of the fence, "a script is what the actors have, a programme is given to the audience".

This is an interesting topic, and I don't think there are very good guidelines for the differentiating a "script" and a "application."

Let's take a look at some Wikipedia articles to get a feel of the distinction.

Script (Wikipedia -> Scripting language):

A scripting language, script language or extension language, is a programming language that controls a software application. "Scripts" are often treated as distinct from "programs", which execute independently from any other application. At the same time they are distinct from the core code of the application, which is usually written in a different language, and by being accessible to the end user they enable the behavior of the application to be adapted to the user's needs.

Application (Wikipedia -> Application software -> Terminology)

In computer science, an application is a computer program designed to help people perform a certain type of work. An application thus differs from an operating system (which runs a computer), a utility (which performs maintenance or general-purpose chores), and a programming language (with which computer programs are created). Depending on the work for which it was designed, an application can manipulate text, numbers, graphics, or a combination of these elements.

Reading the above entries seems to suggest that the distinction is that a script is "hosted" by another piece of software, while an application is not. I suppose that can be argued, such as shell scripts controlling the behavior of the shell, and perl scripts controlling the behavior of the interpreter to perform desired operations. (I feel this may be a little bit of a stretch, so I may not completely agree with it.)

When it comes down to it, it is in my opinion that the colloquial distinction can be made in terms of the scale of the program. Scripts are generally smaller in scale when compared to applications.

Also, in terms of the purpose, a script generally performs tasks that needs taken care of, say for example, build scripts that produce multiple release versions for a certain piece of software. On the otherhand, applications are geared toward providing functionality that is more refined and geared toward an end user. For example, Notepad or Firefox.

John Ousterhout (the inventor of TCL) has a good article at http://www.tcl.tk/doc/scripting.html where he proposes a distinction between system programming languages (for implementing building blocks, emphasis on correctness, type safety) vs scripting languages (for combining building blocks, emphasis on responsiveness to changing environments and requirements, easy conversion in and out of textual representations). If you go with that categorisation system, then 99% of programmers are doing jobs that are more appropriate to scripting languages than to system programming languages.

A script tends to be a series of commands that starts, runs, and terminates. It often requires no/little human interaction. An application is a "program"... it often requires human interaction, it tends to be larger.

Script to me implies line-by-line interpretation of the code. You can open a script and view its programmer-readable contents. An application implies a stand-alone compiled executable.

It's often just a semantic argument, or even a way of denigrating certain programming languages. As far as I'm concerned, a "script" is a type of program, and the exact definition is somewhat vague and varies with context.

I might use the term "script" to mean a program that primarily executes linearly, rather than with lots of sequential logic or subroutines, much like a "script" in Hollywood is a linear sequence of instructions for an actor to execute. I might use it to mean a program that is written in a language embedded inside a larger program, for the purpose of driving that program. For example, automating tasks under the old Mac OS with AppleScript, or driving a program that exposes itself in some way with an embedded TCL interface.

But in all those cases, a script is a type of program.

The term "scripting language" has been used for dynamically interpreted (sometimes compiled) languages, usually these have a lot of common features such as very high level instructions, built in hashes and arbitrary-length lists and other high level data structures, etc. But those languages are capable of very large, complicated, modular, well-designed programs, so if you think of a "script" as something other than a program, that term might confuse you.

See also Is it a Perl program or a Perl script? in perlfaq1.

A script generally runs as part of a larger application inside a scripting engine eg. JavaScript -> Browser This is in contrast to both traditional static typed compiled languages and to dynamic languages, where the code is intended to form the main part of the application.

An application is a collection of scripts geared toward a common set of problems.

A script is a bit of code for performing one fairly specific task.

IMO, the difference has nothing whatsoever to do with the language that's used. It's possible to write a complex application with bash, and it's possible to write a simple script with C++.

First of all, I would like to make it crystal clear that a script is a program. In other words, a script is a set of instructions.

Program:

A set of instructions which is going to be compiled is known as a Program.

Script:

A set of instructions which is going to be interpreted is known as a Script.

Taking perl as an example, you can write perl scripts or perl applications.

A script would imply a single file or a single namespace. (e.g. updateFile.pl).

An application would be something made up of a collection of files or namespaces/classes (e.g. an OO-designed perl application with many .pm module files).

Personally, I think the separation is a step back from the actual implementation.

In my estimation, an application is planned. It has multiple goals, it has multiple deliverables. There are tasks set aside at design time in advance of coding that the application must meet.

A script however, is just thrown together as suits, and little planning is involved.

Lack of proper planning does not however downgrade you to a script. Possibly, it makes your application a poorly organized collection of poorly planned scripts.

Further more, an application can contain scripts that aggregated comprise the whole. But a script can only reference an application.

An application is big and will be used over and over by people and maybe sold to a customer.

A script starts out small, stays small if you're lucky, is rarely sold to a customer, and might either be run automatically or fall into disuse.

What about:

Script:

A script is text file (or collection of text files) of programming statements written in a language which allows individual statements written in it to be interpreted to machine executable code directly before each is executed and with the intention of this occurring.

Application:

An application is any computer program whose primary functionality involves providing service to a human Actor.

A script-based program written in a scripting language can therefore, theoretically, have its textual statements altered while the script is being executed (at great risk of , of course). The analogous situation for compiled programs is flipping bits in memory.

Any takers? :)

@Jeff's answer is good. My favorite explanation is

Many (most?) scripting languages are interpreted, and few compiled languages are considered to be scripting languages, but the question of compiled vs. interpreted is only loosely connected to the question of "scripting" vs. "serious" languages.

A lot of the problem here is that "scripting" is a pretty vague designation -- it means a language that's convenient for writing scripts in, as opposed to writing "full-blown programs" (or applications). But how does one distinguish a complex script from a simple application? That's an essentially unanswerable question. Generally, a script is a series of commands applied to some set of data, possibly in a user-defined order... but then, one could stretch that description to apply to Photoshop, which is clearly a major application. Scripts are generally smaller than applications, do some well-defined thing and are "simpler" to use, and typically can be decomposed into a clear series of sub-operations, but all of these things are subjective.

Referenced from here.

I think that there is no matter at all whether code is compiled or interpreted.

The true difference is in core logic of code:

  • If code makes new functionality that is not implemented in other programs in system - it's a program. It even can be manipulated by a script.

  • If code is MAINLY manipulates by actions of other programs and total result is MAINLY the results of work of manipulated programs - it's a script. Literally a script of actions for some programs.

Actually the difference between a script ( or a scripting language) and an application is that a script don't require it to be compiled into machine language.. You run the source of the script with an interpreter.. A application compiles the source into machine code so that you can run it as a stand alone application.

I would say a script is usually a set of commands or instructions written in plain text that are executed by a hosting application (browser, command interpreter or shell,...).

It does not mean it's not powerfull or not compiled in some way when it's actually executed. But a script cannot do anything by itself, it's just plain text.
By nature it can be a fragment only, needing to be combined to build a program or an application, but extended and fully developed scripts or set of scripts can be considered programs or applications when executed by the host, just like a bunch of source files can become an application once compiled.

A scripting language doesn't have a standard library or platform (or not much of one). It's small and light, designed to be embedded into a larger application. Bash and Javascript are great examples of scripting languages because they rely absolutely on other programs for their functionality.

Using this definition, a script is code designed to drive a larger application (suite). A Javascript might call on Firefox to open windows or manipulate the DOM. A Bash script executes existing programs or other scripts and connects them together with pipes.


You also ask why not scripting languages, so:

Are there even any unit-testing tools for scripting languages? That seems a very important tool for "real" applications that is completely missing. And there's rarely any real library bindings for scripting languages.

Most of the times, scripts could be replaced with a real, light language like Python or Ruby anyway.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top