tags:

views:

3145

answers:

17

I'm referring to distinctions such as in this answer. 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'm genuinely want to what technical differences is being referred to.

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

+14  A: 

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
I think I agree with this answer. I'm realizing that it might have been better to ask about scripting vs. programming languages.
Jon Ericson
I like this definition. Would not have thought of it otherwise.
Nick
+3  A: 

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
A: 

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
Python and Ruby are sometimes slighted as "scripting languages". ;-)
Jon Ericson
Python and Ruby are scripting languages IMHO :)
FlySwat
Python and Ruby are not scripting languages, unless "scripting" has been redefined to meaninglessness.
John Millikin
and what is a "Javacript Application" then. Snakeoil? :P
Kent Fredric
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
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
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
@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
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
@Jason Please point me to documentation on Javascript's standard library. Especially topics like reading files or printing output.
John Millikin
@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
@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
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
( reality has a different API. Damn things undocumented )
Kent Fredric
Turtles all the way down.
Jason Wadsworth
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
Man, I would love to get a peek at the API docs for reality. Maybe just the section on DNA. Now that would be some hard-core programming!
The Digital Gabeg
"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
"PERL...must be a programming language" -- I agree. "C...must be a scripting language" -- why? Haven't you heard of libc?
John Millikin
+10  A: 

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
A: 

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
A: 

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.
+1  A: 

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
+4  A: 

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
+1 "a script is what the actors have, a programme is given to the audience".
Amoeba
A: 

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
+1  A: 

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
+1  A: 

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
A: 

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
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 Ericson
A: 

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.

François
+2  A: 

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
+2  A: 

John Ousterhout (the inventor of TCL) has a good article at http://home.pacbell.net/ouster/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.

d__
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.
d__
A: 

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
+1  A: 

First of all I would like to make crystal clear that Script is a program. On other words 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.

Kannan