Computer programming tends to scare people away with the perception of being too technical, overly complex and extremely hard to follow. There is a common belief that for some people the concepts of programming is just unlearnable.
It is important however, to understand the difference between the programming syntax, something that is
widely diverse and applied differently with different programming languages, and conceptual programming, in other words the ability to follow the path of action in a specific body of code. Contrary to popular belief, the latter is somewhat based on strict common sense.
While it is true that the syntax aspect may add to the clutterness of code and toughen the navigation through it, ultimately the conceptual aspect of programming comes down to one thing: logic. Namely, it is a simple type of logic referred to as “Boolean logic”.
The premise of “Boolean logic” can be explained a more complex manner than the following, but in reality it comes down to True v. False. To take it a step further, “Boolean logic” is applied by using the concepts of checks and iterations. The way these are presented tends to vary from one programming language to another, but conceptually checks are presented in an IF/THEN/ELSE format, while iterations are used in a DO/WHILE format.
To help understand these, it is helpful to not think of these in terms of code, but in terms of a free-flowing thought. Take the following sentence for instance: If it rains today, then the ground will be wet, else it will be dry. Very simple concept, and yet directly correlated to how a program would work with this check. IF A is true, then perform B, else perform C. The A in this case is considered a condition, as the rest of that statement is contingent upon the truthfulness or flasehood of A. B will be the action performed if A is true, and C will be the action performed if A is false. If it rains today (A), the ground will be wet (B), and if it doesn’t rain then the ground will be dry (C).
The use of such checks in code helps the programmer decide what actions to take in particular situations. Expanding upon the earlier concept, a program can contain a lengthy sequence of arguments.
IF A THEN B, ELSE IF C THEN D, ELSE E THEN F,ELSE IF NOT C OR E then G….and so on.
An iteration, commonly known as a loop, traverses through a previously constructed list, often of great length, and performs some action based on the continuation of the list. Lets say there is 1000 entries in a list. The list is of student names, the grade the student is in, the student’s age, their favorite subject and their grade point average. With a DO/WHILE loop, the programmer moves through this list as long as the list exists. When the final entry on the list is reached, the DO/WHILE loop equates to a false value, and the loop ends. In essence, DO move through student list, WHILE there is more entries to move through.
While moving through the list, the programmer has the power to perform actions by incorporating checks into the DO loop. Lets say the loops moves through the student list, and IF the student has a grade average of A, we want to ouput only those patients to display on the screen. The following conceptual loop would then apply: DO move through the student list WHILE it exists, IF the student’s grade point average is A, THEN output the student’s name to the screen.
Programmers often use indexes to help them. An index is a list that is more narrowly defined to the needs of the user who is seeking certain information. In the previous example, it would have probably been easier to have a list indexing the student name with the grade point average, than a list with all the other information that was not useful in this scenario.
In a sense, all the complex looking parts of the code, are all interconnected through logic, since the complex looking piece of code is just a sum of its parts. once broken down, it is easier to understand the actions intended to be taken. The tougher part then is learning the syntax.
Is programming for everyone, probably not, but can anyone who is paying attention and commands the use of common sense connect on a logical level with a program if they are to familiarize themselves with the language’s syntax? Absolutely!