Haramaya University
COLLEGE OF COMPUTING AND INFORMATICS
DEPARTMENT OF INFORMATION SYSTEMS
Chapter One
Data Mining Project on
“Prediction of Chronic Kidney Disease Using Data Mining Classification
Introduction to Computer Techniques”
Programming
By
Tewodros Tilahun
Haramaya University
Chapter Outline
Computer Fundamentals
Evolution of programing language
Language Translators
Algorithm, pseudo code, flow chart
System Development Life Cycle (SDLC)
2
Computer Fundamentals
Introduction
Computer is a device that is used to process data according to a set of
instructions and is capable of performing Arithmetic and Logical operations.
It is a general-purpose machine able to
Accept data
Process it(performs computations, and)
Makes logical decisions according to instructions that have been given to
it.
In our current world, computers are almost used in all walks of life for different
purposes.
3
Computer Fundamentals Cont.…
They have been deployed to solve different real-life problems, from the
simplest game playing app to complex nuclear energy production.
Program
Input Process Output
Storage
4
Computer Fundamentals Cont.…
In order to solve a given problem, computers must be given the correct
instruction about how they can solve it.
In a computer program, you tell a computer step by step exactly what you
want it to do, and then the computer executes the program, following each
step to accomplish the end goal.
5
Computer Fundamentals Cont.…
1. Go straight and you will find the first square
6
Computer Fundamentals Cont.…
2. Turn to the right and drive until you reach the second square
7
Computer Fundamentals Cont.…
3. Turn to the left and go for 50m
8
Computer Fundamentals Cont.…
4. Finally, turn to the right and drive for another 50m and you will see the XY
Campus in front
9
Computer Fundamentals Cont.…
10
Computer Fundamentals Cont.…
To understand the computer program see the following sample C++
Program:
int a=3;
int b=5;
int c= a+b;
cout<<“the sum of a+b is”<<c;
The above computer program instructs the computer to add to numbers and
display the result on the computer screen
11
The Evolution of Programing Language
Computer programs?
Sets of instructions that control a computer’s processing of data
The instructions that tell the computer what to do
Computer programs (also known as source code) is often written by
professionals known as Computer Programmers
Computer programming?
It is the process of writing, testing, debugging/troubleshooting, and maintaining
the source code of computer programs
Programming Language
It is a computer language used by computer programmers to communicate with
the computer
It is a collection of instructions written using any language like:
C++
Java
Python to perform a specific task
12
Types of Programing Language
A computer program usually consists of two elements:
Data – Characteristics
Code – action
Source code is written in one of the programming languages
Programing language can be defined by
Syntactic(syntax) – It is used to describe the rules that tell you which statements are
legal or accepted by the programming language and which are not.
Semantic - The rules which determine the meaning of the instructions.
Programming languages can be divided into two major categories:
Low-Level Language
High-Level Language
13
Machine language
It was the first language in the evolution of computer programming language
It is the only language that the computer can understand directly
Machine language, is a sequence of 0s and 1s that the computer reads and
interprets.
It is machine dependent which means that a particular machine language can be
used on only one type of computer.
Example:
1000011100001101010
14
Assembly language
It is a programming language that uses mnemonics/ symbols to write a program.
Example:
ADD A, B
SUB A, B
MUL A, B
Low level: each instruction is minimal
Assembly language is nothing more than a symbolic representation of machine
code, which allows the symbolic designation of memory locations.
In assembly language, instruction is an easy-to-remember form called a
mnemonic.
However, no matter how close assembly language is to machine code,
computers still cannot understand it. 15
Assembly language
• The instructions first have to be translated into machine language. A program called an
assembler translates the assembly language instructions into machine language(object
code). Some examples of instructions in assembly language and their corresponding
machine language code.
• You can calculate the weekly wages as follows:
LOAD rate
MULT hours
STOR wages
16
High-level languages
It is a computer language which can be understood by the user
Are more English-like and, therefore, make it easier for programmers to "think"
in the programming language.
It is not machine dependent which means that it can be used in a different machine
with little modifications.
It require less time to write and easier to debug error.
High-level languages also require translation to machine language before
execution.
Compilers translate the entire source code program before execution.
Interpreters translate source code programs one line at a time.
17
High-level languages
Some examples of high-level languages:
FORTRAN (FORmula TRANslator),
BASIC (Beginner’s All-Purpose Symbolic Instruction Code)
PASCAL,
C/C++/C#
Python
Java
JavaScript/PHP.
18
Language Translators
What is a language translator?
It is a software program that translates a program written in assembly language and
high-level language to a machine program.
A program written in assembly and high-level language is called source code or
source program and the translated machine code is called object code or object
program.
There are 3 types of language translators:
1. Assembler
2. Interpreter
3. Compiler
19
Types of Language Translators
Assembler
It is a software tool that is used to translate assembly language into machine
language
Compiler
It is a language translator software that is used to translate high-level programs into
machine language
When a compiler converts a source program into a machine program it follows the
syntax rule of the programming language
If an error is present in a program the compiler can't fix it rather it displays an error
message, and you have to correct the error based on the program syntax.
20
Compiler Cont.….
If the program is free from any error then the compiler will convert the entire
source program into machine code at once and finally, the program get
executes.
Example:
Instruction 1;
Instruction 2; Translate Machine code
Execute Output
instruction 3;
instruction 4;
Programing languages like c++ and Java uses a compiler for language
conversion
21
The working principle of compiler
Compile Compil Translate Machine Execute
Source Program er Output
code
Error Fixed
22
Interpreter
It is another type of translator that converts the high-level program into machine
language.
Unlike compilers interpreters convert the source code to machine code line by
line and execute them directly without any further conversion.
Example:
Translate Execute
instruction 1; Machine code Output
Translate Execute
instruction 2; Machine code Output
Translate Execute
instruction 3; Machine code Output
Translate Execute
instruction 4; Machine code Output
23
Interpreter Cont.….
Interpreter displays an error at a time. The programmer should fix that error to
interpret the next line.
Programming languages like Python and PHP uses an interpreter for language
conversion
The working principle of interpreter
Translate Interpre Execute Executable code
Source Program ter i.e. Machine code
Get next instruction Error Fixed
24
Algorithm
An algorithm is the sequence of steps to be performed in order to solve a
problem by the computer is known as an algorithm.
It is a step-by-step description of how to arrive at the solution to the given
problem.
In mathematics, computer science, and related fields an algorithm is a finite
sequence of steps expressed for solving a problem.
Algorithms are used for calculation, data processing, and many other fields.
25
Algorithm cont.….
Hence, in order to qualify as an algorithm, a sequence of instructions must
possess the following characteristics:
Every instruction should be precise and unambiguous
Each instruction should be such that it can be performed in a finite time.
One or more instructions should not be repeated infinitely.
After the algorithm terminates the desired results must be obtained.
26
Quality of Algorithm
The following are the primary factors that are frequently used to judge the quality
of an algorithm:
Time Requirement:
To execute any program computer system may require some amount of time
The algorithm performs better when it requires less amount of time.
Memory Requirement
To execute any program computer system may require some amount of space
The algorithm performs better when it requires less amount of memory space.
27
Quality of Algorithm Cont.…
Accuracy of solution:
Several algorithms may provide correct solutions to a given problem some of these
may provide more accurate results than others.
As a result, we must select the best algorithm based on the accuracy of the solution.
28
Programming Paradigm
A programming paradigm is a fundamental style of programming
Unstructured Programming
consisting only of one large (usually main) program
“main program”' stands for a sequence of commands or statements
data is global throughout the whole program
Disadvantages
Complex
if the same statement sequence is needed at different locations within the program,
the sequence must be copied 29
Programming Paradigm
Procedural programming
Based upon the concept of a procedure call
A procedure call is used to invoke the procedure
Procedures (routines, subroutines, methods, functions) simply contain a series of
computational steps to be carried out to solve a problem
30
Programming Paradigm
Procedural programming
• We have a single program, which is divided into small pieces called procedures
Advantage
To re-use the same code at different places in the program without copying it
Easier way to keep track of program flow
Example
FORTRAN, ADA
31
Programming Paradigm
Object Oriented Programming
• Object-oriented programming is one the new and most powerful paradigms.
• In object-oriented programs, the designer specifies both the data structures and the
types of operations that can be applied to those data structures.
• This pairing of a piece of data with the operations that can be performed on it is
known as object-oriented programming.
• A program thus becomes a collection of cooperating objects, rather than a list of
instructions.
• Objects can store state information and interact with other objects, but generally
each object has a distinct, limited role.32
Problem solving Techniques
• Before a program is written, the programmer must clearly understand what data are to
be used, the desired result, and the procedure to be used to produce the result.
• The procedure, or solution, selected is referred to as an algorithm.
• There are three commonly used tools to help to document program logic (the
algorithm). These are flowcharts, structured chart, and pseudo code.
33
Pseudocode
• Pseudocode is a compact and informal high-level description of a computer algorithm that
uses the structural conventions of programming languages, but typically omits details
such as subroutines, variables declarations and system-specific syntax.
• It is a simpler version of a programming code in plain English which uses short phrases to
write code for a program before it is implemented in a specific
• The purpose of using pseudocode is that it may be easier for humans to read than
conventional programming languages, and that it may be a compact and
environment-independent generic description of the key principles of an
algorithm.
34
Pseudocode
Example1:
Original Program Specification: Write a pseudocode for a program that obtains
two integer numbers from the user and print out the sum of those numbers.
Pseudocode:
Prompt the user to enter the first integer
Prompt the user to enter a second integer
Compute the sum of the two user inputs
Display an output prompt that explains the answer as the sum Display the result
35
Pseudocode
Example 2: Write a pseudocode to find the largest of two numbers by accepting
numbers from the user and printing out the largest one.
BEGIN
NUMERIC nNum1,nNum2
DISPLAY "ENTER THE FIRST NUMBER : "
INPUT nNum1
DISPLAY "ENTER THE SECOND NUMBER : "
INPUT nNum2
IF nNum1 > nNum2
DISPLAY nNum1 + " is larger than "+ nNum2
ELSE
DISPLAY nNum2 + " is larger than " + nNum1
END
36
Pseudocode
Exercise:
Write a pseudocode for a program that obtains one integer number from
the user and prints out the square of the number.
37
Structured Charts
38
Flowchart
A flowchart (also spelled flow-chart and flow chart) is a schematic representation
of an algorithm or a process.
The advantage of a flowchart is it doesn’t depend on any particular programming
language, so that it can be used, to translate an algorithm to more than one
programming language.
Flowchart uses different symbols (geometrical shapes) to represent different
processes.
The following table shows some of the common symbols.
39
Flowchart
40
Flowchart
Example 1: - Draw flow chart of an algorithm to add two numbers and display
their result.
41
Flowchart
Example 2: Draw flow chart of an algorithm that check whether a number is
negative or not.
42
Flowchart
Example 3: Write the algorithmic description and draw a flow chart to find the
following sum.
• Sum = 1+2+3+…. + 50
43
System Development Life Cycle (SDLC)
The Systems Development Life Cycle (SDLC) is a conceptual model used in
project management that describes the stages involved in a computer system
development project from an initial feasibility study through maintenance of the
completed application.
The phases of SDLC are discussed below briefly:
Feasibility study Implementation
Requirements analysis Testing
Designing solution Maintenance
44
Feasibility study
The first step is to identify a need for the new system.
Organizational Feasibility Technical Feasibility
How well the proposed system supports the Hardware, software, and network
strategic objectives of the organization? capability, reliability, and availability
Economic Feasibility Operational Feasibility
Cost savings End user acceptance
Increased revenue Management support
Decreased investment Customer, supplier, and government
Increased profits requirements
45
Requirements analysis : is the process of analyzing the information needs of the
end users, the organizational environment, and any system presently being used,
developing the functional requirements of a system that can meet the needs of the
users.
Designing solution:
After the requirements have been determined, the necessary specifications for
the hardware, software, people, and data resources, and the information products
that will satisfy the functional requirements of the proposed system can be
determined.
The design will serve as a blueprint for the system and helps detect problems
before these errors or problems are built
46
into the final system.
Implementation
The real code is written here. Systems implementation is the construction of the new
system and its delivery into production or day-to-day operation.
Testing
Unit Testing
Integrating Testing
System Testing
Maintenance
What happens during the rest of the software's life: changes, correction,
additions, and moves to a different computing platform and more.
This, the least exciting and perhaps47most important step of all, goes on
seemingly forever.
Thank y u…!