Programming Logic
In any programming activity, one has to develop the simplest expression of the final program so as to help in creating the program. This program expression may be in form of a pseudo code or a flowchart or even both.
Ease arrangement of commands.
Easy monitoring of execution sequence.
Simple to read, understand and create so as to assemble the main program.
Does not depend on the programming language in compilation.
However, some problems are attached to this program expression. They include:
Difficulty in determining whether the sequence in correct or wrong.
Most computers have programming languages that do not follow Standard English.
These shortcomings have led to development of other program expression techniques which come with added advantage. Considering that visual communication through diagrams is much clear than through writing, flow charts are used to develop programs. The main advantages of flowcharts include:
Easy to construct and use.
Clear depiction of execution sequence. Easy to plug in and out expressions to be used in the real program at any stage so as to ensure that the program accomplishes the intended task. However, the main problem of this program expression technique is inadequacy of information given. This is mainly because flowcharts represent may processes summed up making the technique very difficult for introductory programming.
In programming, it is common to find scenarios in which decisions have to be made, signs and expressions have to be inherited and constraints have to be inflicted. This is specific to the programming languages but from a general programming perspective, several programming rules have to be adhered to in any program. One of such rules is variable declaration. In most cases, variables are declared at the beginning of the program, procedure or function. Variables to be used by all sub programs in a program are declared as global variables which are declared as public variables in some languages. These variables can be inherited into the subprograms without necessarily having to declare them again.
Looking at expressions, the process of setting up an expression depends on the declared variables. If one variable is a function of others, then it must have a higher or equal bit capacity depending on the signs used. Most mathematical expressions use standard symbols but these symbols change their meanings in Boolean expressions.
Since many programs depend on decisions and iteration, several structured loops are developed to ease the process of creating programs. The four main loops are: for loop, while loop if loop and case loop. All these loops can be used sequentially depending on the expected restrictions but for most combinations, case loop is used. This is mainly because case loop can handle more decisions and iteration compared to the other loops.