CATEGORIES:

# Variables, expressions and assignment, the elementary input-output, operators of branching and iterated operators.

The main characters make the alphabet of the formal algorithmic language are characters by means of which it is possible to build components, phrases and other language constructions.

The following on complexity a constructive element of language are trivial components; among them select numbers, lines and identifiers.

For the job of arbitrary string including comprehended, in the formal algorithmic language the concept of a line is entered. The line– is sequence admissible the alphabet of language of characters which consists in conjugate quotes and (or) apostrophes.

In that case when it is necessary to designate a simple variable, an array, procedure, the subprogram, a label, identifiers use.

The central parts of any formal algorithmic language are constructed components.

Pointers of functions separate numerical, logical or character values which turn out as a result of use of the given set of rules are defined. In the formal language it is accepted to select fixed functions.

Labels are used as the pointer of the successor by control transmission. Labels in essence represent the identifiers which type is defined as a label; thus they have no values.

Variables with indexes are used as a currency to a separate element of a vector and (or) more difficult data structure. They can be used and as operands in expressions.

Expressions (arithmetical, logical and string). More difficult constructions which in the formal language it is accepted to call the relations are built of expressions. The relations are the constructions consisting of two arithmetical expressions, connected by a sign of operation of the relation.

In normal programming languages there is only one operator whom actually something does, is – assignment operator. All other operators, such as conditional statements and a call of procedures, exist to control sequence of execution of assignment operators. The assignment operator carries out three different tasks:

1. Computation of value of expression in the right part of the operator.

2. Expression evaluation in the left part of the operator; expression shall define a memory cell address.

3. Copying of the value calculated on a step 1, in storage cells, since the address received on a step 2.

Type compatibility monitoring– it is check of that the type of expression is compatible to type of an addressed variable in case of assignment. Also assignment of the actual parameter to the formal here enters in case of a procedure call. The following approaches to type compatibility monitoring are possible:

–Not to do anything; the programmer is responsible for that assignment was meaningful.

–Implicitly to transform value of expression to type which is required in the left part?

–Strict monitoring of type compatibility: a failure from assignment execution if types differ.

Operating operators. Assignment operators are normally executed in that sequence in what they are written. Controlling operators are used for execution order change.

Subprograms are the program segment consisting of data declarations and executed operators which can be caused repeatedly from different parts of the program. Subprograms are called as procedures, functions, subprograms or methods. By a subprogram call the sequence of the values called by parameters is transferred to it. Parameters are applied to set different options of execution of the subprogram, to transfer to it this and to receive results of computation.

Modules. The modern languages of programming offer one more method of structuring for encapsulation of data and subprograms in larger objects which are called as modules.

To research processes of creation of new technologies and to define their main tendencies expediently, comparing these technologies with a programming level of development.

Technology of programming calls set of methods and the means used in development process of the software. The technology of programming represents a set of the technological instructions which are including:

• Specifying of sequence of execution of technological operations;

• Listing of conditions in case of which this or that operation is executed;

• Description of operations

It is possible to tell that it is a certain view of the phenomena of world around and idea of possible actions with them. In programming it is accepted to understand generalization as a paradigm how the program runtime shall be organized.

Among other things select such programming paradigms as directive (structural), object-oriented and declarative (functional and logical). Many languages support some programming paradigms. On the other hand, there are languages oriented only on implementation of one paradigm.

The directive program orders how to reach result, step by step describing actions. Therefore such programming is rather easy for understanding. In the directive programming in due time there was a concept of localization of a part of a code in so-called subprograms (functions, methods), with their subsequent call from different places of the main program. By a call in the subprograms any data in the form of arguments can be transferred; and the subprogram, in turn, can return in the principal program result (i.e. the data obtained during its execution).

Structured programming. In structured programming the sequence of execution of commands completely depends on input data.

Some representatives: Fortran, Pascal, C.

Procedural programming.

Appearance in languages of the means, allowing operating with subprograms was revolutionary. Huge libraries of estimated and official subprograms which were called as required from head programs were as a result created.

The typical program of that time consisted of the main program, area of global data and a set of the subprograms executing processing of all data or their parts. A feeble place of such architecture was that in case of increase in number of subprograms the probability of distortion of a part of global data of any subprogram increased.

To reduce quantity of such errors, it was offered to place local data in subprograms. Appearance of means of support of subprograms allowed realizing software development to several programmers parallel.

In the early sixties «programming crisis» XX century burst. It expressed that firms which undertook development of the difficult software as operating systems, broke all date of completion of projects. Projects became outdated earlier, than were ready to implementation. Objectively all this was called imperfection of technology of programming. First of all development «from below-up» were spontaneously used. This method in case of which simple subprogrammes from which then the difficult tried to create in the beginning were projected and implemented. In absence of accurate models of the description of subprogrammes and methods of their design creation of each separate subprogramme turned into a complex challenge. Interfaces of subprogrammes turned out difficult and in case of their assembly, many errors of coordination came to light. Correction of such errors, as a rule, required serious changes in already developed subprogrammes. Testing and debugging of programs and subprogrammes occupied more than 80 % of time of development. There was a main issue of development of new technologies of creation of difficult programs. It allowed to formulate a new approach in programming which was called «structural».

Concepts of modular and structured programming.

Modular programming assumes separation of groups of the subprogrammes using the same global data in separately compiled modules (library of subprogrammes). Communications between modules when using this technology are carried out via the special interface.

Structural approach to programming represents set of the recommended processing methods enveloping execution of all development stages of the software. At the heart of a structural campaign decomposition (partition on a part) difficult systems for the purpose of the subsequent implementation in the form of separate small (to 40-50-operators) subprogrammes lies. With the advent of other principles of decomposition (object, logical) this method received the name procedural decomposition.

Unlike used earlier procedural approach to decomposition, the structural approach required submission of the task in the form of hierarchy of subtasks of the elementary structure. Design, thus, was carried out «by on top - down» and implied implementation of the general idea, providing study of interfaces of subprogrammes. Restrictions on construction of algorithms were at the same time entered, the formal models of their description, and also the ad hoc method of design of algorithms were recommended – method of step by step detailing.

Support of principles of structured programming was put in a basis of procedural languages of programming. As a rule, they included the main «structural» operators of transmission of control, supported attachment of subprogrammes, localization and restriction of the visibilities area of data. Languages PL/1, ALGOL-68, Pascal, C.

Further growth of complexity and the sizes of the developed software demanded development of structuring data. As a result appeared and the technology of modular programming started to develop

Object-oriented programming.

Object-oriented programming (OOP) is defined as technology of creation of the difficult software, based on submission of the program in the form of set of objects. Each object is a copy of a certain type (class), classes A will form hierarchy with inheritance of properties. Interaction of software objects in such system is carried out by message passing.

The object approach offers new methods of the organization of the programs, based on mechanisms of inheritance, polymorphism, composition, filling. Rapid development of technologies of the programming based on OOP, allowed to create the programming environments supporting visual programming. For example: Delphi, C ++ Builder, Visual C ++.

The wide circulation was received by object-oriented programming languages on which it is easier to implement big and difficult projects. Their difference from languages of the high level consists in discharge possibility from algorithm of execution of the program. By means of such languages the developer as though operates with the virtual objects.

Special attention is given to data which are represented in the program in the form of objects. Objects interact among themselves by means of the message passing mechanism. The task of the programmer – to implement such objects in case of which interaction it will be possible to receive desirable result.

OOP is urged to solve more complex and volume challenges in comparison with the directive programming.

At the heart of OOP such concepts as inheritance, polymorphism and encapsulation lie.

Encapsulation assumes that insignificant details of object are latent. Object, receiving any command, itself «knows» as it to process proceeding from to what class it belongs. All objects are copies of classes which on the relation to each other can appear in a role the parent descendant. Child classes inherit properties parent. In a case when 100% inheritance isn't required, helps out so-called polymorphism which assumes redefinition of methods of parent class in child classes.

Features. The program represents set of possible scenarios of data handling. The choice of the specific scenario depends on approach of this or that event.

Advantages. The main advantages of this class of programming languages are legacy from object-oriented languages.

Ease of use with work benches of computer-aided design and fast creation of a software.

Shortcomings. Complexity of testing. A large number of options which are required to be provided. High probability of ghost effects...

Application. Technology Internet

In the 1980th years Bjyarn Stroustrup, from Bell Laboratories, used with as base of language C ++, having added object-oriented programming support, similar to that which was represented by the Simula language. Many errors of language C are corrected in language C ++. Language was standardized in 1994.

Control questions:

1. Give programming language determination?

2. What languages belong to procedural languages?

3. What you know the programming languages oriented on data?

4. Give object-oriented programming determination?

5. What does the language alphabet mean?

6. Give language syntax determination?

7. Give determination of semantics of language?

8. Give data definitions?

9. What is the assignment operator?

10. What is the programming paradigms?

Date: 2015-12-24; view: 1726

 <== previous page | next page ==> Review of programming languages: history of programming languages. | Review of the modern application software...
doclecture.net - lectures - 2014-2024 year. Copyright infringement or personal data (0.009 sec.)