0% found this document useful (0 votes)
5 views

Chapter-1 COMPUTER PROGRAMING PRE.

Chapter 1 introduces computer programming, covering its definition, reasons to study it, types of programming languages, and programming paradigms such as procedural, functional, and object-oriented programming. It explains the components of computer systems, differentiating between hardware and software, and outlines the role of programming languages in creating software. Additionally, it discusses the importance of language translators like assemblers, compilers, and interpreters in converting code for execution.

Uploaded by

actskebede
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Chapter-1 COMPUTER PROGRAMING PRE.

Chapter 1 introduces computer programming, covering its definition, reasons to study it, types of programming languages, and programming paradigms such as procedural, functional, and object-oriented programming. It explains the components of computer systems, differentiating between hardware and software, and outlines the role of programming languages in creating software. Additionally, it discusses the importance of language translators like assemblers, compilers, and interpreters in converting code for execution.

Uploaded by

actskebede
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 25

Chapter 1 Introduction To

Computer Programming

1
Out line
1.1. What is computer programming
1.2. Reasons to study programming
1.3. Types and usage of computer languages
1.4. Programming paradigms
1.4.1. Procedural programming
1.4.2. Functional programming
1.4.3. Object-oriented Programming

2
Computer Systems

 A computer is made of two major components:


Hardware
Software

Computer

Software Component
Hardware Component
3
Hardware Components
Hardware of a computer system can be referred to as anything which we can touch and
feel.
Include :

Input device

Output device

Hardware Components Central processing unit (CPU)

Secondary storage

4
Software Components
 Computer software refers to a programming code, that is executed on computer hardware that
facilitates the completion of tasks by a computer.
 It is a set of instructions.
 Computer software is divided into two broad categories:
System Software

2 Application Software
 System Software: is responsible for controlling, integrating, and managing the individual
hardware components of a computer system.
 Like operating system, device drivers, and utility programs..

5
Software Components
Application Software:
 Is used to accomplish specific tasks other than just running the computer system
 Consists of programs designed to make users more productive and/or assist them with personal
tasks.
 Simply applications, are often called productivity programs or end-user programs because they
enable the user to complete tasks, such as creating documents, spreadsheets, databases, and
publications, doing online research, sending emails, designing graphics, running businesses, and
even playing games.
 Examples: MS-office, web browsers, database software, photoshop, etc.

6
Computer Programming
 Computer Programming:
 Is the process of creating a set of instructions that tell a computer how to perform a
task.
 Is the process of creating computer software using a programming Language.
 It involves knowing the statements used in a programming language and how to
choose and arrange those statements so that the computer performs the tasks logically.
 The process of writing a computer program is called programming.
 Programs are written by people known as Programmers

7
Why to learn programming

01 To understand how technology works

02 To improve your problem-solving and abstraction skills

To build up our knowledge and become a better worker


03

04 To automatize your daily tasks

To get money
05

06 To open your own business

8
Computer Languages

 A programming language or computer language is a standardized communication


technique for expressing instructions to a computer.
 To write a program for a computer, we must use a computer language.
 Programming languages are basic building blocks for all software, allowing
people to tell computers what to do and the means by which software is
developed.
 Programming languages can be used to create programs that control the
behavior of a machine / to express algorithms accurately.
9
Computer Languages
 Basically, there are two main categories of computer languages:

1 Low Level Language

2 High Level Language

 Low-Level Language:
• Low-level languages are the basic computer instructions or better known as machine codes.
• A computer cannot understand any instruction given to it by the user in English or any other
high-level language.
 These low-level languages are very easily understandable by the machine.
10
Computer Languages
 There are two types of low-level computer language:
 Machine Languages
 Assembly Languages
Machine Languages: This is one of the most basic low-level languages.
 it is machine dependent- it means that a particular machine language can be used on only
one type of computer.
 Machine language is a low-level language that writes programs using the machine code of 1s
and 0s (binary number),which is directly understood by the computer.
 E.g. Machine language code might look like this:
000101101010
11
Computer Languages
Advantages:
 It makes fast and efficient use of the computer
 It doesn't requires translator to translate the code i.e. directly understood by the computer

12
Computer Languages
Assembly Languages:
 Is a low-level symbolic language written using symbolic(abbreviated sets of letters)
or short codes that suggest their meaning.
 Assembly language uses mnemonics or symbolic instructions in place of a sequence
of 0s and 1s.
 It was developed to overcome some of the many inconveniences of machine
language.
 As an example, we can consider that to add registers A and B in a particular
computer, assembly language uses the mnemonic ‘ADD B’.
13
Computer Languages
High-Level Languages:
It is not machining dependent –this means it can be used on different machine
with little modifications.
It easier to learn and understand, because it is like English/ near to natural
language.
It uses variables and objects, Boolean expressions, functions, loops, threads,…
Require less time to write and easier to debug errors.
Is designed for developing user-friendly programs and websites.
 Some examples are: C, C++, FORTRAN, COBOL, Java , Python ,JavaScript, PHP…..
int main()
{
cout << "Hello World!";
return 0; } 14
Programming Paradigms
Paradigm can also be termed as method to solve some problem or do some task.
Programming paradigm is an approach to solve problem using some language
or
Also we can say, it is a method to solve a problem using tools and techniques
that are available to us by following some approach.
It is all about the writing style and organizing the program code in a specific
way.
A programming paradigm represents the fundamental style or methodology of
computer programming ,that define how computer programs are organized and
executed.
They play a crucial role in shaping the design and the development of software
15
systems/program.
Programming Paradigms
 Types of programming paradigms:
 There are several types of programming paradigms, including procedural, object-
oriented, and functional.
 Each of these paradigms has its own set of concepts, tools, and techniques, and
choosing the right one is essential to the success of a project, as it affects the
maintainability, scalability, and performance(efficiency) of the code.
Procedural Programming

Object Oriented Programming


1
2 Functional Programming
3 16
Procedural Programming:
 Procedural programming is a programming paradigm based upon the concept of a
procedure call.
 It is based on the idea of breaking down a problem into a series of procedures or steps that
are executed in sequence/sequential order.
 Procedures, also known as routines, subroutines, methods, or functions simply contain a
series of computational steps to be carried out to solve the problem.
 The focus is on breaking down a problem into smaller, more manageable pieces, and then
solving each piece one at a time.
 Examples of Procedural languages:
 FORTRAN, COBOL, ALGOL, BASIC, C, and Pascal.
17
Object Oriented Programming:
 The program is written as a collection of classes and objects which are meant for
communication.
 The smallest and basic entity is object and all kind of computation is performed on the that
objects only.
 It is based on the idea of organizing code around objects, which are instances of classes.
 In object-oriented programming, objects are primary building blocks of a system, and they
encapsulate data and behavior.
 So, more emphasis on data rather than procedure.
 Example C++, Java, Ruby , Python, Perl, C#, etc.

18
Functional Programming:
 Functional programming is a way of thinking about software construction by creating
pure functions.
 The key principle of this paradigms is the execution of series of mathematical functions.
 The central model for the abstraction is the function which are meant for some specific
computation and not the data structure.
 Functional programming method focuses on results, not the process.
 Functional languages emphasize expressions and declarations rather than the execution of
statements.
 Examples of functional programming
 JS, Lisp, SQL, Scala, Haskell, etc.
19
Cont….
• There are lots of programming languages that are known but all of them need to follow
some strategy when they are implemented this methodology/strategy is a paradigm.

• Each language has its own unique style and is often designed to support a certain
programming paradigm.

• Although, many modern languages are multi-paradigm, meaning they incorporate


features from several paradigms.

• Example, Python combines procedural, object-oriented, and functional


programming paradigms.

20
Computer Language Translators
 A translator is a programming language processor that converts a computer program from one
language to another.
 Language translators are system programs that convert assembly language and high-level
language to machine language for execution, because computers work in machine code only.
 Programs must be translated into machine/Object codes before execution.

Source code Object code


Translator Execution

21
Computer Language Translators
 Types of Language Translator:

Assembler

Translators Compiler

Interpreter
22
Cont..
 Assembler
 An assembler translates assembly language into machine code.
 Assembly language contains machine op-code mnemonics so that assemblers translate from
mnemonics to direct instruction in a 1:1 relation.
 Compiler
 A compiler is a computer program that transforms the entire source code written in a high-
level language into object code for execution.
 is a language translator program that converts code written in a human-readable language, such
as high-level language, to a low-level computer language, such as assembly language, machine
code, or object code, and then produces an executable program.
23
Cont..
 Interpreter
 An interpreter is a computer program that directly executes a high level programming language
one line at a time to run each time the source code is run, because no object code is generated.
 It converts the program one at a time and reports errors detected at once while doing the
conversion.
 It directly executes the operations specified in the source program when the input is given by
the user.

24
h a n k
T
y o u

25

You might also like