What's the difference between a “script” and an “application”?

前端 未结 20 2019
南旧
南旧 2020-12-04 14:53

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 m

相关标签:
20条回答
  • 2020-12-04 14:57

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

    0 讨论(0)
  • 2020-12-04 14:57

    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.

    0 讨论(0)
  • 2020-12-04 14:58

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

    0 讨论(0)
  • 2020-12-04 15:02

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

    0 讨论(0)
  • 2020-12-04 15:03

    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.

    0 讨论(0)
  • 2020-12-04 15:04

    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?

    0 讨论(0)
提交回复
热议问题