36

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.)

Community
  • 1
  • 1
Jon 'links in bio' Ericson
  • 20,880
  • 12
  • 98
  • 148
  • 2
    And what's the difference between those and a “program” and a “solution” (-: – hippietrail May 20 '11 at 10:29
  • 2
    @hippietrail a "solution" fixes things, but a "program" breaks things! – Anonymous Penguin Dec 21 '15 at 15:49
  • Does a specific language lead it to being a script vs an application? – Steven Dec 21 '15 at 19:54
  • I don't think there's any set correct answer, but rather a case-by-case basis. Normally, I use script to refer to a small program that does not need to be built with a compiler. Everything else is an application to me. – DaveTheMinion Dec 22 '15 at 19:06
  • I'd say a script is a single interpreted language (such as a PHP *script* or Java*script*), and a program is usually more than that. But I don't think there's really any technical definition. – Jonathan Lam Dec 23 '15 at 14:45
  • The language doesn't really determine anything. Facebook is (or was) a PHP application and [composer](https://getcomposer.org/) is a PHP program. – Arnold Daniels Dec 24 '15 at 09:25
  • @LambdaNinja I also thought that too, and I still think so. – MasterBob Dec 20 '16 at 03:47

20 Answers20

53

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?

Jeff
  • 6,646
  • 5
  • 27
  • 33
44

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.

Bernard
  • 45,296
  • 18
  • 54
  • 69
32

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".

Thilo
  • 257,207
  • 101
  • 511
  • 656
9

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.

coobird
  • 159,216
  • 35
  • 211
  • 226
8

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.

Henk Langeveld
  • 8,088
  • 1
  • 43
  • 57
  • 3
    PS on the mechanics of Stack Overflow: I think the article is relevant and notable enough to be worth mentioning, but there's an uncomfortable "the party's over, everyone's gone home" feeling about adding to an topic whose answers were clustered into 48 minutes four months ago. –  Jan 16 '09 at 00:45
  • 3
    Yet here we are, some time after that. – Jeff Jun 28 '12 at 06:01
  • 2
    And two years later I updated the link, because I thought this was a good reference. – Henk Langeveld Jul 13 '12 at 08:42
  • 1
    And seven years after that I clicked the link and found it interesting. – Hampus Apr 24 '19 at 14:12
5

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.

Aaron
  • 466
  • 4
  • 12
3

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.

Doug T.
  • 64,223
  • 27
  • 138
  • 202
3

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.

skiphoppy
  • 97,646
  • 72
  • 174
  • 218
2

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.

Martin OConnor
  • 3,583
  • 4
  • 25
  • 32
2

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++.

Jason Wadsworth
  • 933
  • 1
  • 10
  • 18
2

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.

Kent Fredric
  • 56,416
  • 14
  • 107
  • 150
  • Your definition of a script ("thrown together as suits, and little planning is involved") does not match my experience programming and maintaining them. Scripts can be "thrown together", but in my case, they take about as much planning as writing a function in C. – Jon 'links in bio' Ericson Sep 19 '08 at 07:18
1

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.

Mike G
  • 746
  • 5
  • 19
Kannan
  • 19
  • 3
1

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.

Norman Ramsey
  • 198,648
  • 61
  • 360
  • 533
1

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? :)

Mike G
  • 746
  • 5
  • 19
1

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).

mopoke
  • 10,555
  • 1
  • 31
  • 31
0

@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.

FullStack
  • 5,902
  • 4
  • 43
  • 77
0

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.

Eduard Gan
  • 515
  • 5
  • 6
-1

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.

paan
  • 7,054
  • 8
  • 38
  • 44
-1

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.

Francesca
  • 21,452
  • 4
  • 49
  • 90
-2

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.

John Millikin
  • 197,344
  • 39
  • 212
  • 226
  • Python and Ruby are sometimes slighted as "scripting languages". ;-) – Jon 'links in bio' Ericson Sep 19 '08 at 00:22
  • Python and Ruby are scripting languages IMHO :) – FlySwat Sep 19 '08 at 00:23
  • Python and Ruby are not scripting languages, unless "scripting" has been redefined to meaninglessness. – John Millikin Sep 19 '08 at 00:24
  • and what is a "Javacript Application" then. Snakeoil? :P – Kent Fredric Sep 19 '08 at 00:28
  • Yes, since it's not possible to write an entire program using Javascript. You have to write (or re-use) a separate platform like Firefox or Rhino. These are not part of the Javascript language, and thus, do not count when comparing languages. – John Millikin Sep 19 '08 at 00:35
  • Anti-JavaScript snobbery! Every language uses a separate platform on some level to parse and execute the code. JavaScript is just another language, capable of writing "programs" or "scripts". – Jason Wadsworth Sep 19 '08 at 00:41
  • When you talk about a web app as a "javascript application", you are implicitly comparing to a "javascript not-an-application", or a simple webpage. I think "web application" is a more correct and less confusing term - JS apps also need HTML and CSS, which aren't part of JS. – The Digital Gabeg Sep 19 '08 at 00:41
  • @Jason: Sorry, but not all languages use separate platforms. Machine code is so named because it works directly on the machine, and C compilers make machine code. – The Digital Gabeg Sep 19 '08 at 00:43
  • Indeed. But however, you can generate html entirely with javascript in the web browser. and you can have a user enter a singular javascript driven page and never leave it again for the entire time of their stay. ( GMail for example. I would hardly call gmail "merely a web page with a script" ) – Kent Fredric Sep 19 '08 at 00:44
  • @Jason Please point me to documentation on Javascript's standard library. Especially topics like reading files or printing output. – John Millikin Sep 19 '08 at 00:44
  • @Kent: I'm not denying that it's possible to build large or complex systems in a scripting language. But it's still *just* a scripting language. It's relying entirely on the browser's defined evironment, and cannot run outside it. For example, you can't run GMail in Rhino or Apple Dashboard. – John Millikin Sep 19 '08 at 00:48
  • @John Okay, the lack of I/O in JavaScript is a bit of problem isn't it? :) You _could_ make the argument that the code embedded in the machine is a "platform" and that the JS interpreter is the equivalent of the standard I/O library for C. But pretty soon we'd re-define ourselves into stupidity. – Jason Wadsworth Sep 19 '08 at 00:56
  • 1
    Im going to complain I cant run C on my coffee machine, or that objects instantiated in the virtual reality of the computer cant survive in the real world. And thus, everything is a script. :p – Kent Fredric Sep 19 '08 at 01:01
  • ( reality has a different API. Damn things undocumented ) – Kent Fredric Sep 19 '08 at 01:02
  • Ah, but nobody claimed that you could run machine code on arbitrary machines! Only that machine code interacts with the machine without anything in between. ;-) And that was never the real issue anyway, because interpretation is not the critical characteristic of scripting languages. X-P – The Digital Gabeg Sep 19 '08 at 01:18
  • "A scripting language doesn't have a standard library or platform (or not much of one)." So what does that make PERL? That's got a significantly larger set of libraries than C++, so it must be a programming language. By contrast, C (no STL) must be a scripting language. – Ant Sep 19 '08 at 10:30
  • "PERL...must be a programming language" -- I agree. "C...must be a scripting language" -- why? Haven't you heard of libc? – John Millikin Sep 19 '08 at 17:50