Programming Techniques
 
Various programming techniques
 
This section is a short survey of programming techniques. There are various types of programming technique is available in the programming era. Here more focus has been given over OOP.
 
List of Various Programming Technique:
 
1. Unstructured Programming
 
2. Procedural Programming
 
3. Modular Programming
 
4. Object-Oriented Programming (OOP)
 
Unstructured Programming
 
Usually, people start learning programming by writing small and simple programs consisting only of one main program.
 
Here "main program'' stands for a sequence of commands or statements which modify data which is global throughout the whole program.
 
We can illustrate this as shown below:
 
Unstructured programming. The main program directly operates on global data.
 
 
As you should all know, this programming techniques provide tremendous disadvantages once the program gets sufficiently large.
 
For example, if the same statement sequence is needed at different locations within the program, the sequence must be copied.
 
This has lead to the idea to extract these sequences, name them and offering a technique to call and return from these procedures.
 
Procedural Programming
 
With procedural programming you are able to combine returning sequences of statements into one single place.
 
A procedure call is used to invoke the procedure. After the sequence is processed, flow of control proceeds right after the position where the call was made.
 
Execution of procedures. After processing flow of controls proceed where the call was made.
 
 
With introducing parameters as well as procedures of procedures (sub procedures) programs can now be written more structured and error free.
 
For example, if a procedure is correct, every time it is used it produces correct results. Consequently, in cases of errors you can narrow your search to those places which are not proven to be correct.
 
Now a program can be viewed as a sequence of procedure calls. The main program is responsible to pass data to the individual calls, the data is processed by the procedures and, once the program has finished, the resulting data is presented.
 
Thus, the flow of data can be illustrated as a hierarchical graph, a tree, as shown below for a program with no sub procedures:
 
In the Procedural programming technique main program coordinates calls to procedures and hands over appropriate data as parameters.
 
 
Now we have a single program which is divided into small pieces called procedures. To enable usage of general procedures or groups of procedures also in other programs, they must be separately available.
 
For that reason, modular programming allows grouping of procedures into modules.
 
Modular Programming
 
With modular programming procedures of a common functionality are grouped together into separate modules.
 
A program therefore no longer consists of only one single part. It is now divided into several smaller parts which interact through procedure calls and which form the whole program.
 
Modular programming. The main program coordinates calls to procedures in separate modules and hands over appropriate data as parameters.
 
 
Each module can have its own data. This allows each module to manage an internal state which is modified by calls to procedures of this module. However, there is only one state per module and each module exists at most once in the whole program.
 
Object-Oriented Programming
 
Today's large scale software systems are typically designed and implemented using the concepts of the object-oriented model.
 
However, there is still a need for the existing OO languages and architectures to continuously adapt in response to demands for new features and paradigms.
 
These new features include topics such as dynamic software evolution, security, safety, distribution and expressiveness.
 
Object programming is an approach that provides a way of modularizing programs by creating partitioned memory area for both data and functions that can be used as templates for creating copies of such modules on demand.
 
That is, an object is considered to be a partitioned area of computer memory that stores data and set of operations that can access data.
 
Since the memory partitions are independent, the objects can be used in a variety of different program without modifications.
 
In Object-oriented programming technique the Objects of the program interact by sending messages to each other as shown below.
 
 
Comparison of OOP With other procedural languages:
 
Although the languages share common syntax they are very different in nature. C is a procedural language.
 
When approaching a programming challenge the general method of solution is to break the task into successively smaller subtasks. This is known as top-down design.
 
C++ is an object-oriented language. To solve a problem with C++ the first step is to design classes that are abstractions of physical objects.
 
These classes contain both the state of the object, its members, and the capabilities of the object, its methods. After the classes are designed, a program is written that uses these classes to solve the task at hand.
 
Therefore this features extends many other features of OOP. Those feature we will discuss in the last of this section.
 
"Object -Orientation" remains a term which is interpreted differently by different people. It is therefore necessary to understand some of the concept used extensively in OOP.