1.
Explain the Concepts of Programming
1.2.Data structures and algorithms
/Introduction to programming Concepts
This lesson covers the following objectives:
Comparison of Programming Styles.
Processing Styles.
Concept of Algorithm .
Programming Languages
The first programmable computer required the
programmers to write explicit instructions to directly
manipulate the hardware of the computer.
Machine language is often referred to as a “low level
language” since the code directly manipulates the
hardware of the computer.
By contrast, higher level languages such as “C”, C++,
Pascal, COBOL, FORTRAN, ADA and Java are called
“Compiled languages”.
In an interpreted programming language, the statements
that the programmer writes are interpreted as the
program is running.
Eg. - Basic, Visual Basic, Perl and Shell scripting languages
Comparison of Programming Styles
Structured Programming
developed during the 1950s after Edgar
DijkstarDijkstar’s insightful comments into the
harmful nature of the GO To statement.
Dijkstar and others subsequently created a set of
acceptable structures in programming that
would enable development without GO To
statements.
Structured Programming
The structured programming uses three
control constructs namely;
Sequence
Selection
Repetition
Unstructured programming
This is a programming style that was used
before “structured” programming and
predominantly used with lower level languages.
they accomplished the required control of the
program by using GOTO statements
Eg.
Input A
Input B
Go to Add
Back: Print Total
Go to End
------------
Object Oriented Programming
Object-oriented programming (OOP) is an emerging
major programming paradigm.
An object is a particular instance of a class and
consists, essentially, of data which defines its
characteristics and current status together with
procedures, or ‘methods’, which operate on the
object.
For example, an object may be a bank account possessing
data items which record the name and address of its owner
and its current balance. It may have associate methods
which allow its creation, deletion and amendment with
deposits and withdrawals.
Computer Program
A computer program is a sequence instructions that when
performed in a computer carry out a particular task.
two ways to run a program
Sequential processing
Concurrent Processing
Sequential processing
The instructions are performed one after the other
the computer.
The program is stored in the memory and
instructions are fetch one by one and execute within
the CPU.
Concurrent Processing
The instructions are performed in parallel within the
computer.
This may be done using multiple processors or using the
same processor with timesharing.
Concept of Algorithm
When we want to design and implement a program
it is important to develop a “blueprint” of the
program, which details the step by step procedure
in arriving at the solution.
Such “blueprint” is called an algorithm.
The Algorithm
It must concise.
It must be unambiguous
It must be capable of machine execution
It must promote elegance in the solution
The Algorithm
As natural languages do not bear the qualities
mentioned above, following semi-formal
specifications and latterly even formal
specifications were introduced.
Semi-formal specifications- Flow charts, Pseudo code,
Structured English, Decision tables, decision Trees, NS
diagrams… Etc.
Formal specifications – Z specifications, Algebraic
Specifications, Pre and Post conditions…. Etc.
Structured Programming
Sequence
Selection
Repetition
Object Oriented Programming
Sequential
Concurrent
Algorithm
http://en.wikipedia.org/wiki/Flowchart
http://www.computerhope.com/jargon/f/flowchar.htm