"Go" What is "scripting language"

Source: Internet
Author: User

Many people use "scripting language" (scripting language), but few people really know what a scripting language is. Many people use the shell to write "scripts" to accomplish their daily tasks, using Perl or sed to process some text files, and many companies use "scripts" to run their "build" (called Build script). So, what is the difference between a "scripting language" and a "non-scripting language"?

In fact, the "scripting language" and "non-scripting language" do not have the semantics, or the implementation of the way the difference. They differ only in their design: the scripting language is often designed as a temporary "patch." Its designers did not consider it as a "universal programming language", and did not consider using it to build large-scale software. These designers often do not have systematic training, and some even the most basic programming language concepts are not clear. Instead, the "non-scripted" universal programming language, often designed by highly trained experts and even a team of experts, takes "versatility" from the outset, as well as reliability and scalability in large projects.

First, let's look at how the concept of "scripting" is produced. People using Unix systems will be typing in commands that appear to be "disposable" or "can be discarded". Soon, however, it was discovered that these orders were not so "disposable", and that they had been repeatedly typing similar commands, so someone invented the "script" thing. It is designed to be "batch-type" execution commands, you write the commands in a file, and then execute the file. But it was soon discovered that these command lines could actually be constructed in more intelligent ways, such as defining variables or executing different commands depending on the type of system. As a result, people add variables, conditional statements, arrays, and so on for this scripting language. This is how the scripting language is created.

However, people do not find that they do not need scripting language at all. Because these constructs in the scripting language, in any kind of "serious" programming language (such as Java,scheme), already existed, and design more perfect. So the scripting language is often reinventing the wheel, and even the wheels are poorly designed. Early scripting language "advantage", perhaps only because it does not need to "compile", it "invoke the program" when it seems to be less than a few words. The scripting language may have some value for languages like C. However, this advantage is less obvious if compared to a language such as Scheme or Java. For example, you can completely think of an automatic method, after writing the Java code, call the Java compiler, then call the JVM, and finally delete the class file. Or you can choose a "serious language" that has a way of explaining execution, such as Scheme.

Many people mistakenly refer to scheme as the "scripting language" because it interprets execution as a scripting language, but scheme is actually a "serious" language than C and Java. Scheme is designed from the beginning to be a "universal programming language" rather than a single simple task. Scheme designers are more proficient than Java designers, so they are very clear about some of Java's design mistakes. Compilers like Chez scheme have long been able to compile scheme into efficient machine code. In fact, many of the Scheme interpreters also perform a certain amount of "compilation", some compiled into bytecode, some compiled into machine code, and then executed. So in this case, what is often called "compiled language" and "explanatory language", there is almost no fundamental difference, because you see the "interpreter", but the automatic first compile and then execute.

Unlike a language like Java or Scheme, "scripting language" tends to mean poorly designed designs that tend to be short-sighted. These languages are filled with the temporary hack of history, with little "principles" to speak of. A Unix shell (such as bash,csh, ...). ), which is generally the language. Java's design also has a lot of problems, but also with the "scripting language" is a big difference. However, in today's realistic engineering project, scripting language occupies the position that they should not occupy. For example, many companies use shell scripts to handle the "build" process of the entire software or the test process, which is a pretty bad decision. Because once this shell script is expanding, it becomes very difficult to control. Often there are some puzzling problems, but it is difficult to find the problem. Linux uses shell scripts to manage many startup projects, system configuration, and so on, which is a legacy error. So don't think of the shell language as a good thing because you see Linux with so many shell scripts.

If you use the usual programming techniques, such as functions, in a shell script, then the hundreds of-line script will not get out of hand. But I found that a lot of people in the mind of the clear principles of the program design, the encounter "script" such a task is completely collapsed, they seem to think that the script should be "loose" some. Many people who write very smart programs usually start writing shell scripts, or Perl scripts, when they need to handle "system management" tasks. When they write these scripts, they often completely forget the basic principles of programming, such as "modularity," "Abstraction," and so on. They used a lot of things like "environment variables" to pass the information, they forgot to use the function, they were playing around with some temporary patches, just to not have a problem at that time. Later, they began to spend a lot of time to deal with the trouble of the script, but never found the culprit, in fact, they mistakenly think they need a "scripting language", and then think that when writing a script should be casual.

So I think scripting language is a scourge and it's almost always the wrong decision. We should do everything possible to avoid using scripting languages. In the absence of a solution (such as the Boss's request), you should use the usual program design principles in the script as much as possible.

"Go" What is "scripting language"

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.