Structured programming

Structured programming establishes how the program should be encoded. Structured programming uses three basic concepts:

Study analysis – software is always performed for rational work. This rational work is known as the problem of software. Therefore, it is very important that we understand how to solve the problem. With a downward analysis, the problem is divided into small parts, each of which has some kind of meaning. Each problem is solved individually, and steps are clearly indicated by its decision.

Modular programming – during programming, the code is divided into a smaller group of instructions. These groups are known as modules, subprograms or subprograms. Modular programming based on an understanding of downward analysis. It prevents the transitions using ‘Goto’ operators in the program, which often makes the flow flow not trackable. Transitions are prohibited and the modular format is welcome in structured programming.

Structural coding. In accordance with the analysis from top to bottom, structured coding divides the modules into smaller code blocks in the order of their execution. Structured programming uses the control structure that controls the flow of the program, while structured coding uses the control structure to organize its instructions in certain templates.

Functional programming

Functional programming is a style of programming language that uses the concepts of mathematical functions. The function in mathematics should always give the same result when receiving the same argument. In procedural languages, the flow of the program passes through procedures, i.e., the program control is transmitted to the procedure called. While the control flow goes from one procedure to another, the program changes its condition.

In procedural programming, the procedure can give different results when it is called with the same argument, since the program itself can be in a different state when calling. This is a property, as well as a lack of procedural programming, in which the sequence or time of the procedure is important.

Functional programming provides the calculation tools in the form of mathematical functions that give results regardless of the state of the program. This allows you to predict the behavior of the program.

Functional programming uses the following concepts:

Functions of the first class and higher order. These functions can take a different function as an argument or return other functions as a result.

Pure functions-these functions do not include destructive updates, that is, they do not affect any input-output or memory, and if they are not used, they can be easily removed without interfering with the rest of the program.

Recursion-recursion is a programming method in which the function causes itself and repeats the program code in it, if some pre-determined condition does not coincide. Recursion is a way of creating cycles in functional programming.

A strict assessment is a method of assessing the expression, the transmitted function as an argument. Functional programming has two types of assessment methods: strict (impatient) or non -hustle (lazy). A strict assessment always calculates the expression before the function of function. An unstable assessment does not evaluate the expression if it is not required.

λ-read-most functional programming languages ​​use λ-read as types of systems. λ-expression is carried out by evaluating them as they appear.

Common Lisp, Scala, Haskell, Erlang and F # are examples of functional programming languages.

Programming style

Programming style is a set of coding rules that all programmers follow to write code. When several programmers are working on one software project, they often have to work with a software code written by another developer. This becomes tedious or sometimes impossible if all developers do not follow a certain standard programming style for coding the program.

The appropriate programming style includes the use of functions and variables related to the intended task, the use of a correctly placed retreat commenting on the reader and the general representation of the code. This makes the program code readable and understandable to everyone, which, in turn, facilitates debugging and eliminating errors. In addition, the correct coding style helps to facilitate documentation and updating.

Coding Guide

The practice of coding style varies depending on organizations, operating systems and the language itself.

The following encoding elements can be determined in accordance with the guiding principles of coding of the organization:

Names Agreements – this section determines what to call functions, variables, constants and global variables.

The indent is a gap left at the beginning of the line, usually 2-8 gaps or one tab.

Spaces – are usually not indicated at the end of the line.

Operators – defines the rules for writing mathematical, assigning and logical operators. For example, the assignment operator ‘=’ must have a gap to and after it, as in “x = 2”.

Managing structures are the rules for writing iF-teen -else, Case-Switch, While-Byfore and for operators of the control flow exclusively and in the applied form.

Line length and transfer – determines how many characters should be in one line, mainly the length of the line is 80 characters. The flow determines the method of transferring the line if it is too long.

Functions – this determines how the functions should be declared and caused, with parameters and without parameters.

Variables. It indicates how variables of various data types are declared and determined.

Comments are one of the important components of coding, since the comments included in the code describe what the code actually makes and all other related descriptions. This section also helps to create reference documentation for other developers.

Previous PostNextNext Post