6. Programming language Knowledge 6.1 basic knowledge of programming language classification of 6.1.1 programming language
There are 3 factors in programming language, namely, grammar, semantics, pragmatics
Syntax: The structure or form of a program
Semantics: The meaning of the program
Pragmatics: The relationship between programs and users
Classification of programming languages:
(1) By language level, can be divided into low-level language and high-level language
(2) According to user requirements, can be divided into process-based language and non-procedural language
(3) According to the scope of application, can be divided into common language and special language
(4) According to the way of use, can be divided into interactive language and non-interactive language
(5) By component nature, can be divided into sequential language, concurrent language and distribution language
(6) According to the theoretical basis, can be divided into functional language and logical language
Introduction to 6.1.2 Programming language
The major programming languages that appear in history:
(1) APT: Automatic NC program, first dedicated language
(2) FORTRAN: Formula translation programming language
(3) Flow-matic: Commercial Data Processing language
(4) IPL-V: Information Processing language
(5) Comit: String processing and pattern matching language
(6) COBOL: For business-ready languages
(7) ALGOL60: Algorithmic language
(8) LISP: Table Processing Language
(9) JOVIAL: International Algorithmic language
(10) GPSS: Universal System Simulation language
(11) JOSS: First Interactive language
(12) FORMAC: Public translation programming language
(13) Simula: Analog language
(14) APL/360: Programming Language 360
(15) PASCAL: A common high-level programming language
(16) PROLOG: A language for dealing with logical problems
(17) ADA: A programming language with strong expressive ability
(18) BASIC: Beginner's general symbol instruction code
(19) C: One of the most popular advanced programming languages in the world at present
Here are the features of the C language:
• Simple and compact, flexible and convenient
• Rich operator
• Rich data structure
• Segmentation of code and data
• Grammar restrictions are not very strict
• Allow direct access to physical addresses
• High Build Code quality
• Large application Range
(20) C + +: Using a very wide range of computer programming languages
(21) C #: Microsoft Corporation publishes an object-oriented, high-level programming language that runs on the. NET Framework
(22) JAVA: Object-oriented programming language published by Sun Corporation
(23) SQL: Structured Query Language
(24) VB: Event-driven programming language
(25) XML: Data Storage language
(26) VBSCRIPT: scripting language
(27) HTML: Hypertext Markup Language
(28) JAVASCRIPT: scripting language
(29) Actionscript:flash's scripting language
(30) LUA: scripting language
(31) PERL: Practical Report Extraction Language
(32) PHP: Hypertext Preprocessing language
(33) PYTHON: Interpretive programming language
(34) RUBY: scripting language
6.2 Basic knowledge of programming languages (object-oriented language, scripting language, algorithmic complexity) 6.2.1 Object-oriented language
Object-oriented language is a programming language based on object as the Basic program structure unit, designed to object as the core, the object is the basic component of program running, and the class, inheritance and other components are provided in the language.
Object-oriented language features:
(1) Cognitive nature
(2) Category
(3) Polymorphism
(4) Inheritance
6.2.2 Complexity of the algorithm
The merits of an algorithm are mainly measured from the execution time of the algorithm and the two aspects of the storage space required, and the complexity of the algorithm is divided into: time complexity, space complexity
The time complexity of 6.2.2.1 algorithm
Time complexity is measured by the number of executions performed during the algorithm execution
The spatial complexity of 6.2.2.2 algorithm
Space complexity defined as an additional storage space for the algorithm
6.2.3 scripting language
(1) scripting language is a programming language between HTML and C, C + +, Java, and C #
(2) Scripting languages also use variables and functions
(3) scripting languages generally have a corresponding scripting engine to interpret execution, which typically requires an interpreter to run
(4) scripting languages generally exist as text, similar to a command
6.2.4 Assembly language
Assembly language is symbolic machine languages, writing programs more efficient than high-level language
6.3 Related concepts of programming language (variables, parameters, design language style) 6.3.1 Dynamic language and static language
Dynamic language: When the program is running, it can change its structure, new functions are introduced, existing functions can be deleted and other structural changes, such as: JAVASCRIPT, PHP, RUBY, Python and so on are dynamic languages
Static language: All components are determined at compile time and cannot be changed at runtime, for example C, C + +
6.3.2 variable
Variables: The amount of values that can change during a program's run
The following properties are required to define variables:
(1) The identifier of the variable: the name of the variable
(2) The data type of the variable
(3) storage type of variable
• Automatic class
• Static Classes
• Register Class
• External Classes
(4) Scope of variables
• Local variables: variables defined within the function, scoped to function
• Global variables: Defined outside the function, scoped to start of definition and end of source program
The storage space for users is divided into 3 parts:
(1) Program area: Executable code module for storing program
(2) Static storage: The part that holds all global variables and indicates static class local variables
(3) Transport stacks area: storage data is divided into the following several
• When a function is called, the sequence dynamically holds the field of the function execution process, "field protection"
• All local variables not identified as static classes
• Formal parameters of a function
Parameter passing method of 6.3.3 function
Formal parameters: Formal arguments, functions define parameters of a general form of a parameter list, do not have a given value, and do not immediately allocate storage units when processed
Arguments: Actual parameters, given when the key function calls the function, the real arguments data is passed through the stack to the formal parameter
Parameters of the function 3 ways of passing:
(1) Pass value (call by value)
(2) Addresses (call by address)
(3) Citation (call by reference)
6.3.4 Program Design Style
Programming Style: Refers to the characteristics, habits, and logical thinking of a program ape writing a program
Good programming styles include the following:
6.3.4.1 Source program Documentation
• Identifiers should be named according to the meaning of the uniform norms, not arbitrarily
• The program should be annotated
Comments are divided into introductory comments and functional comments
Introductory note: Put in the starting section of each module, including:
• Description of each module
• Explain the interface of the module
• Data Description
• Development history
Functional annotations: Inside the source program, describe the meaning of the statement, the state of the data, including:
• Note the program segments used to illustrate
• Use blank lines or parentheses
• The modified program has also modified the corresponding comments
6.3.4.2 Data Description
• Data description sequence should be standardized
• One statement describes multiple variables, sorted in dictionary order
• Complex data structures to add annotations
6.3.4.3 statement constructs
The principle of statement construction is simple and straightforward, not the pursuit of efficiency to complicate the code
6.3.4.4 Input and output
The input and output consider the following rules:
• Input and input formats as simple as possible
• Check the legality and validity of input data
• Flags that use data or files to end data
• Interactive input with available selection and boundary values
• Maintain consistency of formatting
• Output data table format, graphical
6.3.4.5 efficiency
• Efficiency is a performance requirement, and the goal is given in demand analysis
• The pursuit of efficiency should be based on the readability and reliability of the program without compromising
• The fundamental way to improve program efficiency is to choose a good design method and data structure algorithm
The loop body execution of the for and while statements is 1 less than the number of loop condition judgements
The number of execution times of the loop body is equal to the number of cyclic condition judgments.
6.4 Assembly Language Knowledge 6.4.1
Compilation: The process of translating assembly language programs into machine languages
The features of assembly language:
(1) Low-level language for machines
(2) The advantages of maintaining machine language
(3) Effective access to and control of computer hardware
(4) Short target code, low memory consumption, fast execution speed
(5) often used in conjunction with high-level languages
6.4.2 Compiling
Compiling: The process of turning a high-level language source program into a target program
The working process of compiling: lexical analysis, syntactic analysis, semantic analysis and intermediate code generation, code optimization, target code generation.
(1) Lexical analysis
(2) Grammatical analysis
(3) Semantic check and intermediate code generation
(4) Code optimization
(5) Target code generation
(6) Form management procedures
(7) Error handling Program
6.4.3 Anti-compilation and cross-compiling
Disassembly: The process of converting the target code to assembly code
Decompile: The executable becomes a high-level language program
Cross-compiling: Generate executable code for another platform on one platform
Finite automata: At initial time, the characters are read in turn until the input string ends or the state transition is not found.
Related concepts of the 6.4.4 class
The general form of the class is as follows:
Class name {
Public:
public interface of the class
Private:
Private member functions
Private data member definitions
};
3 different access rights for class Members:
(1) Total members (public): can be accessed outside the class and in subclasses
(2) Private member: can only be accessed by member functions of the class, subclasses and outsiders cannot be accessed
(3) protected member (Protected): can only be accessed by member functions of the class or by members of derived classes, cannot be accessed externally
Table 6-2 access rights for class members
Members |
member functions of the Class (internal) |
Object of the class (external) |
Public |
can access |
can access |
Protected |
can access |
Can not access |
Private |
can access |
Can not access |
The visibility relationship between the base class and the derived class is as follows:
Table 6-3 visibility relationships in derived classes under various inheritance modes
Basic members |
of a derived class How to Inherit |
For derived classes |
object to a derived class |
Public |
Public |
Visible, equivalent to public members |
Visible |
Protected |
Visible, equivalent to protected members |
Not visible |
Private |
Visible, equivalent to private members |
Not visible |
Protected |
Public |
Visible, equivalent to protected members |
Not visible |
Protected |
Visible, equivalent to protected members |
Not visible |
Private |
Visible, equivalent to private members |
Not visible |
Private |
Public |
Not visible |
Not visible |
Protected |
Not visible |
Not visible |
Private |
Not visible |
Not visible |
Ps: Stack overflow, null pointer exception, array subscript out of bounds are problems that can occur when the program runs
The variable is not defined at compile time and can be found
National Computer technology and software Professional technical qualification (proficiency) test "software Evaluator"-Examination content Summary (vi) programming language knowledge