You get a bonus - 1 coin for daily activity. Now you have 1 coin

Programming styles and programming language choice when developing a software product

Lecture



One of the most important features of the classification of programming languages ​​is their belonging to one of the styles, the main of which are the following styles:

- procedural
- functional,
- logical
- object-oriented.

Procedural programming

Procedural (imperative) programming is a reflection of the architecture of traditional computers, which was proposed by von Neumann in the 40s. The theoretical model of procedural programming is an algorithmic system called the "Turing Machine".

The program in a procedural programming language is from the sequence of operators (instructions) defining the procedure for solving the problem. The basic is the assignment operator, which is used to change the contents of memory areas. The concept of memory as a repository of values, the contents of which can be updated by program operators, is fundamental in imperative programming.

The execution of a program is reduced to the sequential execution of statements in order to convert the initial state of the memory, that is, the values ​​of the original data into the final, that is, into the results. Thus, from the point of view of the programmer, there is a program and a memory, with the first sequentially updating the contents of the latter.

Procedural languages ​​are characterized by the following features:

@ the need for explicit memory management, in particular, the description of variables;

@ low suitability for symbolic calculations;

@ the absence of a strict mathematical basis;

@ high efficiency of the implementation of pa traditional computers.

One of the most important classification features of a procedural language is its level. The level of a programming language is determined by the semantic (semantic) capacity of its structures and the degree of its orientation to the programmer. A programming language partially bridges the gap between methods for solving various kinds of problems by a human being and a computer. The more language is focused on the person, the higher its level. We give a brief description of the programming languages ​​implemented on PC in order of increasing their level.

Binary language is directly machine language. At present, such languages ​​are practically not used by programmers.

Assembly Language is a language intended to represent machine readable programs in a readable symbolic form language . It allows the programmer to use mnemonic opcodes, assign convenient names to cells and memory areas, and also set the most convenient addressing schemes.

Macroassembler language is an extension of the Assembly language by the inclusion of macro-tools. With their help, the program can describe the sequence of instructions with parameters - macros. After that, the programmer can use the macro-arguments provided with arguments, which are automatically replaced by macro-extensions in the process of assembling the program. A macro extension is a macro definition with arguments substituted instead of parameters.

In other words, the Macroassembler language represents the means of defining and using new, more powerful commands as a sequence of basic instructions, which somewhat increases its level.

Assembler and Macroassembler languages ​​are used by professional system programmers in order to use all the capabilities of computer hardware and to obtain effective execution times and the required program memory. In these languages, relatively small programs are usually developed that are part of the system software: drivers, utilities, and others.

The C (C) programming language was originally developed to implement the UNIX operating system in the early 70s. Later gained high popularity among system and application programmers. Currently, this language is implemented on most computers.

In C combines the advantages of modern high-level languages ​​in terms of control structures and data structures with access to computer hardware at a level that is usually associated with a low level language such as Assembly language. The C language has a syntax that ensures the brevity of the program, and compilers are able to generate efficient object code.

One of the most significant features of C is leveling the differences between expressions and operators, which brings it closer to functional languages. In particular, the expression can have a side effect of assignment, and can also be used as an operator. There is also no clear boundary between procedures and functions; moreover, the concept of a procedure is not introduced at all.

The syntax of the language makes programming and perception of written programs difficult. There is also no strict data typing, which provides additional opportunities for the programmer, but does not contribute to writing reliable programs.

Basic (BeginnersAll-purposeSymbolicInstructionCode) is a multi-purpose language for symbolic instructions for beginners. It is a simple programming language developed in 1964 for use by beginners. It was developed as the simplest language for direct communication of a person with a computer. Therefore, the original work was carried out online using interpreters. Currently, compilers are also available for this language.

According to the concepts embodied in Basic, this language in the sense of rigor and harmony is the antipode of the Pascal language. In particular, various default rules are widespread in it, which is considered bad form in most programming languages ​​of this type.

Basic is widely distributed on computers of various types and is very popular among programmers, especially beginners. There are many dialects of this language that are not compatible with each other. Basic actively absorbs many concepts and innovations from other languages. Therefore, it is quite dynamic, and it is impossible to unambiguously determine its level.

Pascal is one of the most popular procedural programming language among application programmers, especially for PC. Developed in 1970 by Professor N. Wirth, a Swiss specialist in the field of computer technology, the language is named after a French mathematician and, according to the author, was intended to teach programming. However, the language was so successful that it became one of the main tools of application and system programmers in solving problems of a computational and informational nature. In 1979, a draft language description was prepared - the British Standard of the PascalBS6192 programming language, which also became the international standard ISO 7185.

The Pascal language implements a number of concepts considered as the basis of “disciplined” programming and subsequently borrowed by developers of many languages. One of the essential features of the Pascal language is the consistent and fairly complete implementation of the concept of structured programming. Moreover, this is done not only by organizing the links between the program management fragments, but also by structuring the data. In addition, the language implements the concept of defining new data types based on existing ones. This language, unlike language C, is strongly typed. Pascal is characterized by:

? high level;

? ample opportunities;

? slimness, simplicity and brevity;

? rigor, contributing to the writing of effective and reliable programs;

? high efficiency of realization on the computer.

Pascal is implemented on computers of various types, but the most common and developed for PC. Currently, such versions of this language for PC as Borland Pascal and Turbo Pascal are widely used.

Functional programming

The essence of functional (applicative) programming is defined by A. P. Ershov as “... a method of compiling programs in which the only action is to call a function, the only way to dismember the program in a part is to enter a name for the function, and the only composition rule is the function superposition operator. No memory cells, no assignment operators, no cycles, no more flowcharts, no control transfers. ”

The role of the basic construct in functional languages ​​is expression. Expressions include scalar constants, structured objects, functions, function bodies, and function calls. The function is treated as a one-to-one mapping from X ^ to X, where X is a set of expressions.

The applicative programming language includes the following elements:

classes of constants with which functions can manipulate;

? a set of basic functions that a programmer can use without prior declaration and description;

? rules for building new functions from basic ones?

? rules for forming expressions based on function calls.

The program is a set of descriptions of functions and expressions that must be calculated. This expression is calculated by reduction, that is, a series of simplifications, as long as it is possible by the following rules: the calls of the basic functions are replaced by the corresponding values; calls to non-basic functions are replaced by their bodies, in which the parameters are replaced by arguments.

Functional programming does not use the concept of memory as a repository of variable values. Assignment operators are absent, as a result of which variables designate not areas of memory, but objects of a program, which fully corresponds to the concept of a variable in mathematics. In principle, it is possible to make programs without any variables at all. In addition, there are no significant differences between constants and functions, that is, between programs and data. As a result, the function may be the value of a call to another function and may be an element of a structured object. The number of arguments when calling a function does not have to match the number of parameters specified in its description. These properties characterize applicative languages ​​as very high level programming languages.

The first such language was LISP (LISTProcessing - list processing), created in 1959. The purpose of its creation was to organize the convenience of processing symbolic information. An essential feature of this language is the unification of program structures and data structures: all expressions are written in the form of lists.

Logic programming

A new field - logical, or relational programming - has opened up the appearance of the PROLOG {Prolog} language (PROgramminginLOGic - programming in terms of logic). This language was created by the French scientist A. Kolmeroe in 1973. Other languages ​​are now known, but Prolog is the most developed and widely used logic programming language. So, there are over 15 different implementations of it on a PC. Logic programming languages, especially Prolog, are widely used in artificial intelligence systems covered in this tutorial.

The central concept in logic programming is relation. A program is a set of definitions of relationships between objects (in terms of conditions or restrictions) and a goal (request). The process of program execution is interpreted as a process of validity of a logical formula built from a program according to the rules established by the semantics of the language used. The result of the calculation is a by-product of this process. In relational programming, you only need to specify the facts on which the algorithm is based, and not to determine the sequence of steps to be performed. This demonstrates the declarativeness of the logic programming language. It is aptly expressed in R. Kovalsky's formula: “algorithm = logic + control”. Logic programming languages ​​are characterized by:

- high level;

- strict orientation to symbolic calculations;

- the possibility of inverse calculations, that is, variables in the procedures are not divided into input and output;

- possible logical incompleteness, since it is often impossible to express certain logical relations in the program, and it is also impossible to get all the conclusions from the program correct.

Logical programs, in principle, have a small speed, since the calculations are carried out by trial and error, search with returns to the previous steps.

Object Oriented Programming

A prototype of object-oriented programming was a series of tools that make up the language of SIMULA-67. But in an independent style it took shape with the advent of the SMALLTALK language, developed by A. Kay in 1972 and originally intended for the implementation of computer graphics functions.

The object-oriented programming style is based on the concept of an object, and its essence is expressed by the formula: “object = data + procedures”. Each object integrates in itself some data structure and procedures available for processing this data, which are called methods. Combining data and procedures in a single object is called encapsulation and is inherent in object-oriented programming.

To describe the objects are classes. The class defines the properties and methods of an object belonging to this class. Accordingly, any object can be defined as an instance of a class.

The programming of the considered style consists in the selection of existing ones or the creation of new objects and the organization of interaction between them. When creating new objects, properties of objects can be added or inherited from ancestor objects. In the process of working with objects, polymorphism is allowed - the ability to use methods with the same name to process data of different types.

The most modern object-oriented programming languages ​​are C ++ and Java.

The C ++ language was developed in the early 80s by B. Straustrup, an employee of the Bell Lab at AT & T. He created a compact compiling system, in which language C was taken as a basis, supplemented by elements of the languages ​​BCPL, Simula-67 and Algol-68. By July 1983, C appeared with classes, and a little later, C ++. By 1990, the third version of the C ++ language was released, adopted by the ANSI committee as the source material for its standardization.

In 1990, an employee of the Sun Corporation D. Gosling developed the object-oriented language Oak on the basis of the C ++ extension, the main advantage of which was the provision of networking between devices of various types . New integrated into the Internet version of the language, called Java. The first browser that supported the Java language was developed by Sun P. Naphton, a programmer at Sun Corporation, and was named HotJava. Since January 1995, Java is becoming available on the Internet.

According to the official definition of the authors, Java is a simple object-oriented and architecturally neutral language of the interpreting type, providing reliability, security and portability, with high performance combined with multithreading and dynamism.

The fundamental difference between Java and C ++ is that the first one is interpretable, and the second is compiled. The syntax of the languages ​​is almost the same.

In terms of the capabilities of the object-oriented tools themselves, the Java language has several advantages over the C ++ language. Thus, the Java language demonstrates a more flexible and powerful information encapsulation system. The inheritance mechanism implemented in Java requires a more rigorous approach to programming, which improves the reliability and understanding of the code. The C ++ language has a complex, inadequate and difficult to understand inheritance system. The possibilities of dynamic binding of objects are equally well represented in both languages, however, the syntactic redundancy of C ++ makes us prefer Java here as well.

By virtue of their constructiveness, the ideas of object-oriented programming are used in many universal procedural languages. So, for example, the special object-oriented programming library TurboVision is included in the PASCAL (Borland International Corporation) version 5.5 integrated programming system.

Recently, many programs, especially object-oriented, are being implemented as visual programming systems. A distinctive feature of such systems is a powerful development environment for programs from ready-made “building blocks”, which allows you to create an interface part of a software product in the dialog mode, with almost no coding of software operations. Object-oriented visual programming systems include: VisualBasic, Delphi, C ++ Builder, and Visual C ++.

See also


Comments


To leave a comment
If you have any suggestion, idea, thanks or comment, feel free to write. We really value feedback and are glad to hear your opinion.
To reply

Software and information systems development

Terms: Software and information systems development