A block diagram is a way of presenting an algorithm in the form of a visual graphical diagram. A special form is used to visually explain certain steps for the cells of the flowchart. Not every algorithm can be described with a flowchart, but this method is suitable for many tasks.
Organization of the flowchart
A graphical model of the algorithm is needed in order to look at the sequence of actions and mentally cover it all. It is known that the human brain is much better at solving problems when it presents a complex situation, and a block diagram is an ideal way to describe algorithms for programming in this way.
All blocks in the block diagram are interconnected by means of lines, meaning connections between them.
The study of flowcharts is part of the compulsory computer science curriculum in high school. A description of this technique can be found in the textbooks. Since the use of flowcharts makes programming easier, almost every blog that teaches readers to write code also talks about this method.
Elements of the block diagram
The elements of a flowchart are geometric shapes, inside of which you write code or a description of actions. The scheme always begins with an elongated oval. It means the beginning or end of a program, as well as the beginning or end of a function (call and return). In a broader sense, it can be said that this is the beginning and end of the problem.
The rectangle is used to list operations, arithmetic or assignment. This is an action block.
A rhombus is a logical block that contains a condition. It means checking for a condition, then branching. Branching directions can be either two (the "if, then" construction), or several (usually in programming languages such a construction is described by the word "case")
The rectangle with pillars on the sides is a predefined process block. It describes the call to the subroutine and lists the variables that are passed. For example, this is how a function call is denoted.
Parallelogram is a data input / output block. It lists the data to be sent to the output device or received from the input device.
A horizontally elongated hexagon. This figure represents a cycle. Inside, the initial value of the loop variables, its step and the exit condition are written. This block can be divided into two halves, then the beginning of the cycle is written in the first, and the end in the second, and all operations are placed in the middle.
Features of the use of block diagrams
UML diagrams are used to describe how applications written in the object approach work.
Block diagrams are applicable only for those programming languages that are based on a structured approach. For artificial languages, for example, for low-level languages, this way of describing the algorithm will not work. Likewise, if you write in an object language within the framework of an object-oriented programming paradigm, then the interaction between objects cannot be described using a flowchart. For such cases, other methods of visualizing the algorithm are used.