Getting Started-programming language understanding

Source: Internet
Author: User

Let's take a look at the programming language, which is mainly categorized from the following angles:

Compiled and interpreted, static and dynamic languages, strongly typed definition languages, and weakly typed definition languages.

Compiled type

The compiled language is actually the same as the other Assembly languages: there is a translation program to convert our source code, generate the corresponding executable code, this process is called compilation (Compile), and the compiler responsible for compiling is naturally called the compiler (Compiler). If we write the program code is contained in a source file, then usually compiled after the direct generation of an executable file, we can run directly. But for a more complex project, for ease of management, we usually distribute the code in various source files as different modules to organize. When you compile individual files, you generate the target files (object file) instead of the executable file that you said earlier. Typically, a source file is compiled with a target file. The contents of these target files are basically executable code, but because they are only part of the entire project, we cannot run them directly. After all the source files have been compiled, we can finally "package" these semi-finished target files into an executable file, which is the responsibility of another program, because this process seems to be to assemble the target file containing executable code, so called link, The program that is responsible for linking is called the link program (Linker). In addition to linking the target file, there may be a variety of resources, such as icon files, sound files and so on, but also responsible for removing redundant duplication of code between the target files, and so on. Once the link is complete, you will generally get the executable file we want.

Explanatory type

Literally, "compilation" and "Interpretation" do have the meaning of "translation", and their difference is that the timing of the translation is not very similar. For example: If you are going to read a foreign language book, and you do not know it, then you can find a translator, give him enough time to translate the whole book from beginning to end, and then give you the native language version of the book to read, or you can immediately let the interpreter assist you to read, let him sentence to you to translate, If you want to look back at a chapter, he will have to re-translate it for you.

Two ways, the former is equivalent to what we just said the compiler: once all the code into the machine language, and then written into the executable, and the latter is equivalent to the interpretation of the type: in the first moment of the program run, there is only the source program and no executable program, and every execution of the program to the source program, a command, There will be a shell called an interpreter that transforms the source code into binary code for execution, and in general, explains, executes, interprets, executes ... Therefore, the interpretation procedure is inseparable from the interpretation procedure. Like the early basic is a classic interpretation of the language, in order to execute the basic program, you have to enter the basic environment before you can load the program source files, run. In an explanatory program, because the program is always in the form of source code, the porting is almost no problem as long as there is a corresponding interpreter. Compiled program Although the source code can also be ported, but before the different systems must be compiled separately, for complex engineering, it is really a small time consumption, and it is likely that some of the details of the place or to modify the source code. Moreover, the interpretation of the program saves the steps of compiling, debugging is also very convenient, editing can be run immediately, do not have to be like a compiled program every small change must be patient waiting for a long compiling ... Linking ... This process of compiling links. However, there are pros and cons, because the interpretation procedure is to put the process of compilation into the implementation process, which determines that the interpretation of the program is destined to be slower than the compilation of a large section, like hundreds of times times the speed gap is not surprising.

Compiled and interpreted type, both have pros and cons

The former because the program execution speed, the same conditions on the system requirements are low, so like the development of operating systems, large-scale applications, database systems, such as the use of it, such as C + +, Pascal/object Pascal (Delphi), VB and other basic can be regarded as compiled language, and some web script , server scripts, and auxiliary development interfaces for applications where speed requirements are low and the compatibility of different system platforms are required, it is common to use explanatory languages such as Java, JavaScript, VBScript, Perl, Python, and so on.

Dynamic language and static language

Usually we call dynamic language, static language refers to dynamic type language and static type language.

(1) Dynamic type language: Dynamic type language refers to the language of data type checking during run time, that is, when programming in a dynamic type language, you never have to specify a data type for any variable, and the language will record the data type internally when you assign it to a variable for the first time. Python and Ruby are a typical dynamic type language, and many other scripting languages, such as VBScript, are also dynamic type languages.

(2) Static type language: Static type language is just the opposite of dynamic type language, its data type is checked during compilation, that is, when writing a program to declare all variables of the data type, C + + is a static type language typical representative, other static type language also has C #, JAVA and so on.

For dynamic language and static language distinction, apply a popular word is: static typing when possible, dynamic typing when needed.

Strongly typed definition language and weak type definition language

(1) Strongly typed definition language: A language that enforces the definition of a data type. In other words, once a variable is assigned a data type, it is always the data type if it is not cast. For example: If you define an integer variable A, the program simply cannot treat a as a string type. A strongly typed definition language is a type-safe language.

(2) Weakly typed definition language: a language in which data types can be ignored. In contrast to strongly typed definition languages, a variable can assign values of different data types.

Strongly typed definition language may be slightly slower than weak type definition language, but the rigor of strong type definition language can effectively avoid many errors. In addition, "The language is not a dynamic language" and "the language is the type of security" is completely no connection between!
For example: Python is a dynamic language and is a strongly typed definition language (type-safe language); VBScript is a dynamic language and is a weak type definition language (type unsafe language); JAVA is a static language and is a strongly typed definition language (type-safe language).

Getting Started-programming language understanding

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.