Python Programming Basics (programming language classification)

Source: Internet
Author: User

I. Introduction to Programming languages

Programming languages are categorized mainly from the following perspectives: compiled and interpreted, static and dynamic, strongly typed, and weakly type definition languages.

1. Compilation type and explanatory type

compiled , in fact, he and assembly language is the same, there is a translation process to ask our source to convert, generate the corresponding executable code. This process is called a professional compilation ( Compile compile ). If we write the program code 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, in order to facilitate management, we usually code scattered in various source files, as different modules to organize. This is the target file generated when compiling individual files ( object file link 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.

interpreted , literally, "compilation" and "Interpretation" do have the meaning of "translation", the difference is that the timing of the translation is not quite the same. For example: if you intend to read a foreign language book, and you do not know the foreign languages, then you can find a translator, give him enough time to let him from the beginning of the book translation Good, and then the book in the native language version to you to read, or you can 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 call the compiler: once all the code into the machine language, and then write the executable file, and the latter is equivalent to the explanation we want to say: In the first moment of the program run, and only the source code program does not have an executable program, and the program every execution to the source code 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 source files, run. In the explanatory program, because the program always appears in the form of source code, so long as there is a corresponding interpreter, the transplant is almost no problem. Compiled program Although the source code can also be ported, but the premise is that the different systems must be compiled separately, for complex engineering, the real part of the time consumption, and it is likely that some details of the place or to modify the source. Moreover, the explanation Type program saves the compile step, the modification debugging is also more convenient, edits completes immediately can run, does not need to be like compiles the program every time to make the small change to wait patiently the long compiling ... Linking ... This process of compiling links. But everything has advantages and disadvantages, because the interpretation of the 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 compiler program a large section, like hundreds of times times the gap is not surprising.

The difference between the compiler and the explanatory:

compiled and interpreted type, both have pros and cons. The former because of the fast program execution, the same conditions on the system requirements are low, so like the development of operating systems, large applications, database systems, such as the use of it, such as C + +,PascalPascal( Delphi),VB and other basic can be regarded as a compilation language, and some Web scripts, server footsteps and auxiliary development interface such speed requirements are not high, the compatibility of different system platforms have certain requirements of the program is usually used in explanatory language, such as Java,Javascript,vbsscript,Perl , Python and so on.

However, since the compilation and interpretation of the pros and cons of each other, so a group of emerging languages have the two languages in a balanced trend, such asJavaAlthough the language is closer to the characteristics of an interpreted language, it is pre-compiled prior to execution, and the generated code is between the machine code and theJavathe intermediary code between the source code, when run by theJVM(Javavirtual machine platform, which can be interpreted as an interpreter) to interpret execution. It preserves the source code of high abstraction, portable features, and has completed the majority of the source of the compilation work, so the implementation is much faster than the "pure interpretation" program. And likeVB6(or previous version),C #such a language, though ostensibly to be generated by the. EXEexecutable file, butVB6after compiling the actual generated is also a kind of intermediary code, but the compiler placed in front of an automatic call an external interpreter code (the interpreter program independent and user-written program, stored in the system of aDLLfile, all of theVB6compile the generated executable to use it), has explained the execution of the actual program body. C #(and other. NETlanguage compiler) is the build. NETtarget code, which is actually executed by the. NETexplain the system (just likeJVM, as well as a virtual machine platform) for execution. Of course. NETThe target code is already fairly "low" and is closer to the machine language, so it is still considered a compiled language, and its portability is notJavaso powerful as that,JavaIt's called "compile once, execute everywhere," and. NETis "encode once, compile everywhere." In a word, with the development of design technology and hardware, the visual field of the two ways of compiling and interpreting is constantly becoming blurred.

2. 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 other scripting languages such as VBScript are much more dynamic-type languages.

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

3. 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) weak type definition language: The data type can be ignored language, but the rigorous nature of the strong type definition language can effectively avoid many errors. In addition,"This language is not dynamic language" and "the language is type safe" is completely no connection between!

For example: Python is a dynamic language, a strongly typed definition language (type-safe language),VBScript is a dynamic language, is a weak type definition language (type unsafe language),JAVA is a static language and is a strongly typed definition language (type-safe language).

from the above, we can conclude thatPython is a strongly typed definition language with dynamic explanatory ability.

Python Programming Basics (programming language classification)

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.