|
In general, the programming language can be divided into two categories: compiled languages and interpreted languages.
Compiled language
Many of the traditional programming languages such as Fortran, Ada, Pascal, C, C ++ and Java, are compiled language. We need this kind of language previously written source code (source code) is converted into object code (object code), this process is called "compilation."
When you run the program directly reads the object code (object code). Because of compiled object code (object code) are very close to the bottom of the computer, so a high efficiency, which is an advantage of compiled languages.
However, due to compiled languages mostly operate in the ground floor are dealing with byte, integer, float, or other machine-level objects, often achieve a simple function requires a lot of complex code. For example, in C ++, it is difficult "to copy all the files in a directory to another directory" simple operation like that.
Interpreted language
Interpreted languages are also called "scripting languages." When implementing such a program, the interpreter (interpreter) We need to read the source code written in (source code), and converts it into object code (object code), then run by the computer. Because each execution are more of the build process, so efficiency is decreased.
The benefits of using scripting languages is that they are mostly run in compiled languages is higher than the hierarchy of files and directories can easily handle such objects; drawback is that their efficiency is usually better than a compiled language. On balance, however, generally use scripting is still worthwhile: to spend an hour of simple scripts written, the same function in C or C ++ to write an implementation, may take two days, and, in general, script execution speed is fast enough , fast enough to make it ignore performance problems. Examples of scripting language of awk, Perl, Python, Ruby and Shell.
When using the Shell
Because Shell seems to be a common feature among UNIX systems, and through the standardized POSIX. Thus, Shell script as long as "carefully written" one, can be applied to many systems. Thus, the reason for using the Shell scripts are based on:
Simplicity: Shell is a high-level language; through it, you can succinctly express complex operations.
Portability: use POSIX defined functions can be done without modifying the script can be executed on different systems.
Development easy: You can complete a powerful and Yu with script in a short time.
However, considering the Shell script command limit and efficiency, the following generally do not use Shell:
Resource-intensive task, especially when you consider efficiency (for example, sorting, hash, etc.).
Need to handle large tasks math operations, especially floating-point operations, precise operation, or complex arithmetic operations (which generally use C ++ or FORTRAN to handle).
There are cross-platform (OS) porting requirements (generally use C or Java).
Complex applications, must be used in structured programming time (need to check the type of a variable, function prototypes, etc.).
The impact of global system for mission-critical applications.
For high security requirements of the task, for example, you need a robust system to prevent intrusion, cracks, vandalism and so on.
Project consists of various parts of a series of dependent components.
Require large-scale file operations.
We need to support multi-dimensional arrays.
Support requires a data structure, such as a list or a number of data structures.
Need to produce or operate graphical interface GUI.
Require direct manipulation of system hardware.
Need I / O or socket interface.
Interface needs to use the library or the legacy of the old code.
Private, closed-source applications (shell scripts put code in a text file, the whole world can see).
If your application meets the top of any one, then consider it a more powerful language - perhaps Perl, Tcl, Python, Ruby-- or higher level compiled language such as C / C ++, or Java. Even so, you will find that the use of shell to prototyping your application in the development step is also very useful. |
|
|
|