General Programming Concepts
General Programming Concepts
I will discuss here, basic programming concepts that are at the basis of any modern programming
language. Once we have these concepts well printed in mind, the transition to the modern computing
will be much easier.
A. Computer organization
1. Input: The input unit is the part that takes the raw data from us and prepares it for
processing.
2. Storage: In order for the CPU to process the data, it has to be placed in an area where
the CPU can take it and perform operations, as well as writing the results. Since the CPU
is very fast in executing these operations, the instructions have to be fed at the same
speed. We discussed in the Inside the Computer…link here – a few things about the
main memory.
3. Processing: The task of performing arithmetic and logical operations. For this action the
CPU takes data and instructions from the main memory and processes, and creates
meaningful information which is sent back to the Storage Unit (Main Memory).
4. Output: where the results produced by the computer after processing are kept before
being given in human readable form.
5. Control: takes care of step by step processing of all operations performed inside the
computer.
6. CPU: made of ALU (arithmetic logical unit –what the name implies –performs the 4
operations, logic and comparison, and returns results to storage unit for further
processing or simply to get stored) and CU (control unit determines the sequence in
which instructions should be executed, switch board for cases when more than one user
interacts with the computer simultaneously, issue signals to other units of the computer
for execution – the manager of all operations mentioned above).
Flowcharting
Since we are reviewing general concepts of programming, I was thinking to jump straight
into flow-charting and leave programming constructs (loops, if-then-else, goto, iterations
and cases) when I will present the programming languages that are common to the modern
technology. Not sure if this is for everyone, but I remember flowcharting since I was student
in College, and kind of put it aside ever since in designing the logic of my programs, and
that’s bad. At least for me it was. Even for OO paradigm, and UML languages, it is
important to be comfortable to represent the logic of any piece of complex code in a
diagram.
Magnetic Tape
Magnetic Disk
Off-page connector
Flow line
Annotation
Display
Guidelines for flowcharting:
or
e. Only one flow line should enter a decision symbol, but two or three flow lines, one for
each possible answer, should leave the decision symbol.
g. Write within standard symbols briefly. As necessary, you can use the annotation symbol
to describe data or computational steps more clearly.
h. If the flowchart becomes complex, it is better to use connector symbols to reduce the
number of flow lines. Avoid the intersection of flow lines if you want to make it more
effective and better way of communication.
i. Ensure that the flowchart has a logical start and finish.
j. It is useful to test the validity of the flowchart by passing through it with a simple test
data.
It is limited to cases where the logic is simple. When there’s more complexity other
types of models may be required. (We’ll take a look at Unified Modeling Language). The
essentials of what is done are sometimes lost in the details of how it is done. Never the
less it is a good starting point for any new program or enhancements to other programs.
2 Examples: