İntroduction to Computer Programing
İntroduction to Computer Programing
COMPUTER
PROGRAMMING
History of Programming Languages
Electronic computers were invented in 1940’s. They are huge and
expensive. Machine language is used (0’s and 1’s). The Machine
Language for each computer is specific to only that computer.
Later, Assembly Language is invented. It has simple instructions such
as ADD A, B, C. It is easier than Machine Language. However, the time
and effort required for programming were enormous, and it is still
machine dependent.
The next step in the evolution of programming languages was the
invention of High Level Languages that are machine independent and
easier to use.
3
History of Programming Languages
Languages like LISP and BASIC are often interpreted, while more
complex languages like PASCAL and C are generally compiled. There
are also some languages, such as Java, which are first compiled and
then interpreted.
C is a small language. A small language is a beautiful language in
programming. C has fewer keywords than Pascal, where they are
known as reserved words, yet it is arguably the more powerful
language. C gets its power by carefully including the right control
structures and data types, and allowing their uses to be nearly
unrestricted where meaningfully used. The language is readily learned
as a consequence of its functional minimality.
4
Computer Programming
A computer is a programmable machine. This means it can execute a
programmed list of instructions and respond to new instructions that it
is given.
Computer Programming is the process of developing and implementing
various sets of instructions to enable a computer to do a certain task.
Programs are written to solve problems or perform tasks on a
computer.
5
Computer Programming
Programmers translate the solutions or tasks
into a language the computer can understand.
As we write programs, we must keep in mind
that the computer will only do what we instruct
it to do.
Because of this, we must be very careful and
thorough with our instructions
6
Computer Programming
7
Computer Programming
WHO IS THE FIRST COMPUTER PROGRAMMER?
8
Algorithm
An ALGORITHM is a list of instructions,
procedures, or formulas used to solve the
problem.
The word was derived from the name of
the mathematician Mohammed ibn Musa-
al Khwarizmi (El-Harezmî-780-850)
9
Pseudocode
In computer science, pseudocode is a description of the steps in an
algorithm using a mix of conventions of programming languages (like
assignment operator, conditional operator, loop) with informal, usually self-
explanatory, notation of actions and conditions.
Although pseudocode shares features with regular programming languages,
it is intended for human reading rather than machine control. Pseudocode
typically omits details that are essential for machine implementation of the
algorithm, meaning that pseudocode can only be verified by hand. The
programming language is augmented with natural language description
details, where convenient, or with compact mathematical notation.
12
Source Code
The source code consists of the programming statements that are created
by a programmer with a text editor or a visual programming tool and then
saved in a file.
For example, a programmer using the C language types in a desired
sequence of C language statements using a text editor and then saves
them as a named file.
This file is said to contain the source code.
13
Flowchart
A flowchart is a formalized graphic representation of a logic sequence,
work or manufacturing process, organization chart, or similar formalized
structure.
The purpose of a flow chart is to provide people with a common language
or reference point when dealing with a project or process.
Flowcharts use simple geometric symbols and arrows to define
relationships.
14
Programming Languages
Computer programming is almost always done by means of Programming
Language
There exists 8965 programming languages in the world!!
Some of them are known by only their developers
For further information:
https://en.wikipedia.org/wiki/List_of_programming_languages
This is an index to notable programming languages, in current or historical
use. Dialects of BASIC, esoteric programming languages, and markup
languages are not included. A programming language does not need to be
imperative or Turing-complete, but must be executable and so does not
include markup languages such as HTML or XML, but does include domain-
specific languages such as SQL and its dialects.
15
Programming Languages
16
History of Programming Languages
18
Programming Language Generations
1GL or first-generation language was (and still is) machine language or the
level of instructions and data that the processor is actually given to work
on.
2GL second-generation language is assembler (sometimes called
‘’assembly’’) language.
3GL or third-generation language is a "high-level" programming language,
such as PL/I, C, or Java. A compiler converts the statements of a specific
high-level programming language into machine language. A 3GL language
requires a considerable amount of programming knowledge.
➢ 4GL or fourth-generation language is designed to be closer to natural
language than a 3GL language. Languages for accessing databases are
often described as 4GLs.
19
Programming Language Generations
5GL or fifth-generation language is programming that uses a visual or
graphical development interface to create source language that is usually
compiled with a 3GL or 4GL language compiler. Microsoft, Borland, IBM,
and other companies make 5GL visual programming products for
developing applications in Java, for example. Visual programming allows
you to easily envision object-oriented programming class hierarchies and
drag icons to assemble program components.
20
Machine Language (Machine Code)
Machine code, also known as machine language, is the elemental
language of computers, comprising a long sequence of binary digital zeros
and ones (bits).
Sometimes referred to as machine code or object code, machine language
is a collection of binary digits or bits that the computer reads and interprets.
Machine language is the only language a computer is capable of
understanding.
21
Assembly Language
Sometimes referred to as assembly or ASL, assembly language is a low-
level programming language used to interface with computer hardware.
Assembly language uses structured commands as substitutions for
numbers allowing humans to read the code easier than looking at binary.
Although easier to read than binary, assembly language is a difficult
language and is usually substituted for a higher language such as C
22
Low-level Languages
Low-level languages have the advantage that they can be written to take
advantage of any peculiarities in the architecture of the central processing
unit (CPU).
Thus, a program written in a low-level language can be extremely efficient,
making optimum use of both computer memory and processing time.
However, to write a low-level program takes a substantial amount of time,
as well as a clear understanding of the inner workings of the processor
itself. Therefore, low-level programming is typically used only for very small
programs, or for segments of code that are highly critical and must run as
efficiently as possible.
23
High-level Languages
High-level languages permit faster development of large programs. The
final program as executed by the computer is not as efficient, but the
savings in programmer time generally far outweigh the inefficiencies of the
finished product.
This is because the cost of writing a program is nearly constant for each
line of code, regardless of the language.
Thus, a high-level language where each line of code translates to 1-0
machine instructions costs only one tenth as much in program
development as a low-level language where each line of code represents
only a single machine instruction.
24
High-level Languages
25
Programming Language Properties
https://www.tiobe.com/tiobe-index/
26
Compiler
A compiler is a special program that processes statements written in a
particular programming language and turns them into machine language or
"code" that a computer's processor uses.
After you write a program, your source language statements are compiled
into machine code that is stored as an executable file.
Scripting languages like Perl and PHP do not need to be compiled.
27
Structured Programming (modular programming)
Structured programming (sometimes known as modular programming) is a
subset of procedural programming that enforces a logical structure on the
program being written to make it more efficient and easier to understand
and modify. Certain languages such as Ada, Pascal, and dBASE are
designed with features that encourage or enforce a logical program
structure.
Structured programming frequently employs a top-down design model, in
which developers map out the overall program structure into separate
subsections.
Program flow follows a simple hierarchical model that employs looping
constructs such as "for“, "repeat“, and "while" Use of the "Go To" statement
is discouraged.
28
Structured Programming (modular programming)
Structured programming was first suggested by Corrado Bohm and
Guiseppe Jacopini. The two mathematicians demonstrated that any
computer program can be written with just three structures: decisions,
sequences, and loops.
29
Object-Oriented Programming (OOP)
Object-oriented programming (OOP) is a programming language model
organized around ‘’objects’’ rather than ‘’actions’’ and data rather than
logic.
Historically, a program has been viewed as a logical procedure that takes
input data, process it, and produces output data.
30
Classification of Programming Languages
Procedure-oriented programming
COBOL, FORTRAN, Pascal and C
Object oriented programming
Objective C, C++, Java, and PHP
31