SlideShare a Scribd company logo
1 of 17
1
Programming Languages &Programming Languages &
StructureStructure
University of Education Okara Campus
UniversityofEducationOkara
Campus
Part 1
2
Describe the evolution of programming languages from machineDescribe the evolution of programming languages from machine
language to high-level languages. Understand how a program inlanguage to high-level languages. Understand how a program in
a high-level language is translated into machine language.a high-level language is translated into machine language.
Distinguish between four computer language paradigms.Distinguish between four computer language paradigms.
Understand the procedural paradigm and the interaction betweenUnderstand the procedural paradigm and the interaction between
a program unit and data items in the paradigm. Understand thea program unit and data items in the paradigm. Understand the
object-oriented paradigm and the interaction between a programobject-oriented paradigm and the interaction between a program
unit and objects in this paradigm. Define functional paradigmunit and objects in this paradigm. Define functional paradigm
and understand its applications. Define a declaration paradigmand understand its applications. Define a declaration paradigm
and understand its applications. Define common concepts inand understand its applications. Define common concepts in
procedural and object-oriented languages.procedural and object-oriented languages.
ObjectivesObjectives
After studying this chapter, the student should be able to:After studying this chapter, the student should be able to:
UniversityofEducationOkara
Campus
3
9-1 EVOLUTION9-1 EVOLUTION
To write a program for a computer, we must use aTo write a program for a computer, we must use a
computer language. A computer language is a set ofcomputer language. A computer language is a set of
predefined words that are combined into a programpredefined words that are combined into a program
according to predefined rules (according to predefined rules (syntax). Over the years,). Over the years,
computer languages have evolved fromcomputer languages have evolved from machine
language toto high-level languages..
UniversityofEducationOkara
Campus
4
Machine languages
UniversityofEducationOkara
Campus
In the earliest days of computers, the only programming
languages available were machine languages. Each
computer had its own machine language, which was made of
streams of 0s and 1s. We need to use eleven lines of code to read
two integers, add them and print the result. These lines of code,
when written in machine language, make eleven lines of binary
code, each of 16 bits, as shown in Table 9.1.
The only language understood by a computer is machine language.The only language understood by a computer is machine language.
5
UniversityofEducationOkara
Campus
6
Assembly languages
The next evolution in programming came with the idea of
replacing binary code for instruction and addresses with symbols
or mnemonics and is called symbolic languages.
UniversityofEducationOkara
Campus
7
High-level languages
Although assembly languages greatly improved programming
efficiency, they still required programmers to concentrate on the
hardware they were using. Working with symbolic languages was
also very tedious, because each machine instruction had to be
individually coded. The desire to improve programmer efficiency
and to change the focus from the computer to the problem being
solved led to the development of high-level languages.
Over the years, various languages, most notably BASIC,
COBOL, Pascal, Ada, C, C++ and Java, were developed.
Program 9.1 shows the code for adding two integers as it would
appear in the C++ language.
UniversityofEducationOkara
Campus
8
UniversityofEducationOkara
Campus
C++ Program to add two numbers
#include<iostream.h>
#include<iostream.h>
Void main() {
Clrscr();
Int a=5, b=10;
Int c = a+b;
Cout<<c;
Getch();
}
9
9-2 TRANSLATION9-2 TRANSLATION
Programs today are normally written in one of thePrograms today are normally written in one of the
high-level languages. To run the program on ahigh-level languages. To run the program on a
computer, the program needs to be translated into thecomputer, the program needs to be translated into the
machinemachine languagelanguage of the computer on which it willof the computer on which it will
run. The program in a high-level language is called therun. The program in a high-level language is called the
sourcesource program. The translated program in machineprogram. The translated program in machine
language is called thelanguage is called the objectobject program. Two methodsprogram. Two methods
are used for translation:are used for translation: compilation andand
interpretation..
UniversityofEducationOkara
Campus
10
Compilation
A compiler normally translates the whole source
program into the object program.
Source Code > Object Code
Interpretation
Some computer languages use an interpreter to translate
the source program into the object program.
Interpretation refers to the process of translating each
line of the source program into the corresponding line of
the object program and executing the line. However, we
need to be aware of two trends in interpretation: that is
used by some languages before Java and the
interpretation used by Java.
UniversityofEducationOkara
Campus
11
Translation process
Compilation and interpretation differ in that the first
translates the whole source code before executing it,
while the second translates and executes the source code a
line at a time. Both methods, however, follow the same
translation process shown in Figure 9.1.
Figure 1 Source code translation process
UniversityofEducationOkara
Campus
12
9-3 PROGRAMMING PARADIGMS9-3 PROGRAMMING PARADIGMS
Today, computer languages are categorized according toToday, computer languages are categorized according to
the approach they use to solve a problem. Athe approach they use to solve a problem. A
paradigm, therefore, is a way in which a computer, therefore, is a way in which a computer
language looks at the problem to be solved. We dividelanguage looks at the problem to be solved. We divide
computer languages into four types:computer languages into four types: proceduralprocedural,, object-object-
orientedoriented,, functionalfunctional andand declarativedeclarative. Figure 9.2. Figure 9.2
summarizes these.summarizes these.
UniversityofEducationOkara
Campus
13
Figure 2 Categories of programming languages
UniversityofEducationOkara
Campus
14
The Procedural Language
A program in a procedural paradigm is an active agentA program in a procedural paradigm is an active agent
that uses passive objects that we refer to as data or datathat uses passive objects that we refer to as data or data
items. To manipulate a piece of data, the active agentitems. To manipulate a piece of data, the active agent
(program) issues an action, referred to as a procedure.(program) issues an action, referred to as a procedure.
For example, think of a program that prints the contentsFor example, think of a program that prints the contents
of a file. The file is a passive object. To print the file, theof a file. The file is a passive object. To print the file, the
program uses a procedure, which we call print.program uses a procedure, which we call print.
Derived from Structured Programming.Derived from Structured Programming.
UniversityofEducationOkara
Campus
Procedural Object-oriented
procedure method
record object
module class
procedure call message
15
Figure 3 The concept of the procedural paradigm
UniversityofEducationOkara
Campus
16
A program in this paradigm is made up of three parts: a
part for object creation, a set of procedure calls and a
set of code for each procedure. Some procedures have
already been defined in the language itself. By
combining this code, the programmer can create new
procedures.
Figure 4 The components of a procedural program
UniversityofEducationOkara
Campus
17
Some procedural languages
 FORTRAN (FORmula TRANslation)
 COBOL (COmmon Business-Oriented Language)
 Pascal
 C
 Ada
UniversityofEducationOkara
Campus

More Related Content

What's hot

Ndu06 typesof language
Ndu06 typesof languageNdu06 typesof language
Ndu06 typesof language
nicky_walters
 
Programming Language
Programming  LanguageProgramming  Language
Programming Language
Adeel Hamid
 
Programming language design and implemenation
Programming language design and implemenationProgramming language design and implemenation
Programming language design and implemenation
Ashwini Awatare
 
Basic programming concepts
Basic programming conceptsBasic programming concepts
Basic programming concepts
salmankhan570
 
Principles of-programming-languages-lecture-notes-
Principles of-programming-languages-lecture-notes-Principles of-programming-languages-lecture-notes-
Principles of-programming-languages-lecture-notes-
Krishna Sai
 

What's hot (20)

Ndu06 typesof language
Ndu06 typesof languageNdu06 typesof language
Ndu06 typesof language
 
Programming Language
Programming  LanguageProgramming  Language
Programming Language
 
PROGRAMMING LANGUAGES
PROGRAMMING LANGUAGESPROGRAMMING LANGUAGES
PROGRAMMING LANGUAGES
 
Comparative Study of programming Languages
Comparative Study of programming LanguagesComparative Study of programming Languages
Comparative Study of programming Languages
 
Programming language design and implemenation
Programming language design and implemenationProgramming language design and implemenation
Programming language design and implemenation
 
Programming paradigm
Programming paradigmProgramming paradigm
Programming paradigm
 
Basic programming concepts
Basic programming conceptsBasic programming concepts
Basic programming concepts
 
Programming Languages
Programming LanguagesProgramming Languages
Programming Languages
 
Prgramming paradigms
Prgramming paradigmsPrgramming paradigms
Prgramming paradigms
 
Object oriented concepts ppt
Object oriented concepts pptObject oriented concepts ppt
Object oriented concepts ppt
 
Theory of programming
Theory of programmingTheory of programming
Theory of programming
 
Programming landuages
Programming landuagesProgramming landuages
Programming landuages
 
Programming languages
Programming languagesProgramming languages
Programming languages
 
Principles of-programming-languages-lecture-notes-
Principles of-programming-languages-lecture-notes-Principles of-programming-languages-lecture-notes-
Principles of-programming-languages-lecture-notes-
 
Programing Language
Programing LanguagePrograming Language
Programing Language
 
SD & D Implementation
SD & D ImplementationSD & D Implementation
SD & D Implementation
 
Paradigms
ParadigmsParadigms
Paradigms
 
Evolution of Programming Languages
Evolution of Programming LanguagesEvolution of Programming Languages
Evolution of Programming Languages
 
Computer Programming Overview
Computer Programming OverviewComputer Programming Overview
Computer Programming Overview
 
Introduction to c++ ppt 1
Introduction to c++ ppt 1Introduction to c++ ppt 1
Introduction to c++ ppt 1
 

Viewers also liked

Programming fundamentals lecture 1&2
Programming fundamentals lecture 1&2Programming fundamentals lecture 1&2
Programming fundamentals lecture 1&2
Raja Hamid
 

Viewers also liked (20)

levels of system
levels of systemlevels of system
levels of system
 
Report Management System
Report Management SystemReport Management System
Report Management System
 
Information System's Planning and Change Management
Information System's Planning and Change ManagementInformation System's Planning and Change Management
Information System's Planning and Change Management
 
System Design
System DesignSystem Design
System Design
 
Lect 1-16-8-10
Lect 1-16-8-10Lect 1-16-8-10
Lect 1-16-8-10
 
Type Systems
Type SystemsType Systems
Type Systems
 
Programming fundamentals lecture 1&2
Programming fundamentals lecture 1&2Programming fundamentals lecture 1&2
Programming fundamentals lecture 1&2
 
Information system implementation, change management and control
Information system implementation, change management and controlInformation system implementation, change management and control
Information system implementation, change management and control
 
System Development Proecess
System Development ProecessSystem Development Proecess
System Development Proecess
 
Internet & Animal Sciences
Internet & Animal SciencesInternet & Animal Sciences
Internet & Animal Sciences
 
Itertaive process-development model
Itertaive process-development modelItertaive process-development model
Itertaive process-development model
 
Introduction to java programming part 1
Introduction to java programming part 1Introduction to java programming part 1
Introduction to java programming part 1
 
Introduction to java programming part 2
Introduction to java programming  part 2Introduction to java programming  part 2
Introduction to java programming part 2
 
How Information System is Implmanted in an Organization
How Information System is Implmanted in an OrganizationHow Information System is Implmanted in an Organization
How Information System is Implmanted in an Organization
 
Fundamental Programming Lect 1
Fundamental Programming Lect 1Fundamental Programming Lect 1
Fundamental Programming Lect 1
 
M s access
M s accessM s access
M s access
 
Zoology Related Software
Zoology Related SoftwareZoology Related Software
Zoology Related Software
 
Lecture 1 Information System
Lecture 1  Information SystemLecture 1  Information System
Lecture 1 Information System
 
Information System & Organizational System
Information System & Organizational SystemInformation System & Organizational System
Information System & Organizational System
 
transaction processing system
transaction processing systemtransaction processing system
transaction processing system
 

Similar to Introduction to programming languages part 1

Procedural Programming Of Programming Languages
Procedural Programming Of Programming LanguagesProcedural Programming Of Programming Languages
Procedural Programming Of Programming Languages
Tammy Moncrief
 
ICT-DBA4 -05-0811-Apply-Object-Oriented-Programming-Language-Skills.doc
ICT-DBA4 -05-0811-Apply-Object-Oriented-Programming-Language-Skills.docICT-DBA4 -05-0811-Apply-Object-Oriented-Programming-Language-Skills.doc
ICT-DBA4 -05-0811-Apply-Object-Oriented-Programming-Language-Skills.doc
AmanGunner
 
Specification Of The Programming Language Of Java
Specification Of The Programming Language Of JavaSpecification Of The Programming Language Of Java
Specification Of The Programming Language Of Java
Kim Moore
 
Introduction to Programming Concepts By Aamir Saleem Ansari
Introduction to Programming Concepts By Aamir Saleem AnsariIntroduction to Programming Concepts By Aamir Saleem Ansari
Introduction to Programming Concepts By Aamir Saleem Ansari
Tech
 
Concept of computer programming iv
Concept of computer programming ivConcept of computer programming iv
Concept of computer programming iv
Eyelean xilef
 
Algorithm and flowchart(1)
Algorithm and flowchart(1)Algorithm and flowchart(1)
Algorithm and flowchart(1)
Suneel Dogra
 

Similar to Introduction to programming languages part 1 (20)

Procedural Programming Of Programming Languages
Procedural Programming Of Programming LanguagesProcedural Programming Of Programming Languages
Procedural Programming Of Programming Languages
 
ICT-DBA4 -05-0811-Apply-Object-Oriented-Programming-Language-Skills.doc
ICT-DBA4 -05-0811-Apply-Object-Oriented-Programming-Language-Skills.docICT-DBA4 -05-0811-Apply-Object-Oriented-Programming-Language-Skills.doc
ICT-DBA4 -05-0811-Apply-Object-Oriented-Programming-Language-Skills.doc
 
Specification Of The Programming Language Of Java
Specification Of The Programming Language Of JavaSpecification Of The Programming Language Of Java
Specification Of The Programming Language Of Java
 
Chapter 5
Chapter 5Chapter 5
Chapter 5
 
Introduction to systems programming
Introduction to systems programmingIntroduction to systems programming
Introduction to systems programming
 
Introduction to Programming Concepts By Aamir Saleem Ansari
Introduction to Programming Concepts By Aamir Saleem AnsariIntroduction to Programming Concepts By Aamir Saleem Ansari
Introduction to Programming Concepts By Aamir Saleem Ansari
 
Unit 1
Unit 1Unit 1
Unit 1
 
JAVA
JAVAJAVA
JAVA
 
SYSTEM DEVELOPMENT
SYSTEM DEVELOPMENTSYSTEM DEVELOPMENT
SYSTEM DEVELOPMENT
 
Programming
ProgrammingProgramming
Programming
 
Grade 8: Introduction To Java
Grade 8: Introduction To JavaGrade 8: Introduction To Java
Grade 8: Introduction To Java
 
Chapter 1
Chapter 1Chapter 1
Chapter 1
 
History Of C Essay
History Of C EssayHistory Of C Essay
History Of C Essay
 
CSCorganization of programming languages
CSCorganization of programming languagesCSCorganization of programming languages
CSCorganization of programming languages
 
Unit 1_Evaluation Criteria_session 3.pptx
Unit 1_Evaluation Criteria_session 3.pptxUnit 1_Evaluation Criteria_session 3.pptx
Unit 1_Evaluation Criteria_session 3.pptx
 
Software programming and development
Software programming and developmentSoftware programming and development
Software programming and development
 
Computer Programming
Computer Programming Computer Programming
Computer Programming
 
Computer
ComputerComputer
Computer
 
Concept of computer programming iv
Concept of computer programming ivConcept of computer programming iv
Concept of computer programming iv
 
Algorithm and flowchart(1)
Algorithm and flowchart(1)Algorithm and flowchart(1)
Algorithm and flowchart(1)
 

More from university of education,Lahore

More from university of education,Lahore (20)

Activites and Time Planning
 Activites and Time Planning Activites and Time Planning
Activites and Time Planning
 
Steganography
SteganographySteganography
Steganography
 
Classical Encryption Techniques
Classical Encryption TechniquesClassical Encryption Techniques
Classical Encryption Techniques
 
Activites and Time Planning
Activites and Time PlanningActivites and Time Planning
Activites and Time Planning
 
OSI Security Architecture
OSI Security ArchitectureOSI Security Architecture
OSI Security Architecture
 
Network Security Terminologies
Network Security TerminologiesNetwork Security Terminologies
Network Security Terminologies
 
Project Scheduling, Planning and Risk Management
Project Scheduling, Planning and Risk ManagementProject Scheduling, Planning and Risk Management
Project Scheduling, Planning and Risk Management
 
Software Testing and Debugging
Software Testing and DebuggingSoftware Testing and Debugging
Software Testing and Debugging
 
ePayment Methods
ePayment MethodsePayment Methods
ePayment Methods
 
SEO
SEOSEO
SEO
 
A Star Search
A Star SearchA Star Search
A Star Search
 
Enterprise Application Integration
Enterprise Application IntegrationEnterprise Application Integration
Enterprise Application Integration
 
Uml Diagrams
Uml DiagramsUml Diagrams
Uml Diagrams
 
eDras Max
eDras MaxeDras Max
eDras Max
 
RAD Model
RAD ModelRAD Model
RAD Model
 
Microsoft Project
Microsoft ProjectMicrosoft Project
Microsoft Project
 
Itertaive Process Development
Itertaive Process DevelopmentItertaive Process Development
Itertaive Process Development
 
Computer Aided Software Engineering Nayab Awan
Computer Aided Software Engineering Nayab AwanComputer Aided Software Engineering Nayab Awan
Computer Aided Software Engineering Nayab Awan
 
Lect 2 assessing the technology landscape
Lect 2 assessing the technology landscapeLect 2 assessing the technology landscape
Lect 2 assessing the technology landscape
 
system level requirements gathering and analysis
system level requirements gathering and analysissystem level requirements gathering and analysis
system level requirements gathering and analysis
 

Recently uploaded

1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 

Recently uploaded (20)

microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Role Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptxRole Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptx
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 

Introduction to programming languages part 1

  • 1. 1 Programming Languages &Programming Languages & StructureStructure University of Education Okara Campus UniversityofEducationOkara Campus Part 1
  • 2. 2 Describe the evolution of programming languages from machineDescribe the evolution of programming languages from machine language to high-level languages. Understand how a program inlanguage to high-level languages. Understand how a program in a high-level language is translated into machine language.a high-level language is translated into machine language. Distinguish between four computer language paradigms.Distinguish between four computer language paradigms. Understand the procedural paradigm and the interaction betweenUnderstand the procedural paradigm and the interaction between a program unit and data items in the paradigm. Understand thea program unit and data items in the paradigm. Understand the object-oriented paradigm and the interaction between a programobject-oriented paradigm and the interaction between a program unit and objects in this paradigm. Define functional paradigmunit and objects in this paradigm. Define functional paradigm and understand its applications. Define a declaration paradigmand understand its applications. Define a declaration paradigm and understand its applications. Define common concepts inand understand its applications. Define common concepts in procedural and object-oriented languages.procedural and object-oriented languages. ObjectivesObjectives After studying this chapter, the student should be able to:After studying this chapter, the student should be able to: UniversityofEducationOkara Campus
  • 3. 3 9-1 EVOLUTION9-1 EVOLUTION To write a program for a computer, we must use aTo write a program for a computer, we must use a computer language. A computer language is a set ofcomputer language. A computer language is a set of predefined words that are combined into a programpredefined words that are combined into a program according to predefined rules (according to predefined rules (syntax). Over the years,). Over the years, computer languages have evolved fromcomputer languages have evolved from machine language toto high-level languages.. UniversityofEducationOkara Campus
  • 4. 4 Machine languages UniversityofEducationOkara Campus In the earliest days of computers, the only programming languages available were machine languages. Each computer had its own machine language, which was made of streams of 0s and 1s. We need to use eleven lines of code to read two integers, add them and print the result. These lines of code, when written in machine language, make eleven lines of binary code, each of 16 bits, as shown in Table 9.1. The only language understood by a computer is machine language.The only language understood by a computer is machine language.
  • 6. 6 Assembly languages The next evolution in programming came with the idea of replacing binary code for instruction and addresses with symbols or mnemonics and is called symbolic languages. UniversityofEducationOkara Campus
  • 7. 7 High-level languages Although assembly languages greatly improved programming efficiency, they still required programmers to concentrate on the hardware they were using. Working with symbolic languages was also very tedious, because each machine instruction had to be individually coded. The desire to improve programmer efficiency and to change the focus from the computer to the problem being solved led to the development of high-level languages. Over the years, various languages, most notably BASIC, COBOL, Pascal, Ada, C, C++ and Java, were developed. Program 9.1 shows the code for adding two integers as it would appear in the C++ language. UniversityofEducationOkara Campus
  • 8. 8 UniversityofEducationOkara Campus C++ Program to add two numbers #include<iostream.h> #include<iostream.h> Void main() { Clrscr(); Int a=5, b=10; Int c = a+b; Cout<<c; Getch(); }
  • 9. 9 9-2 TRANSLATION9-2 TRANSLATION Programs today are normally written in one of thePrograms today are normally written in one of the high-level languages. To run the program on ahigh-level languages. To run the program on a computer, the program needs to be translated into thecomputer, the program needs to be translated into the machinemachine languagelanguage of the computer on which it willof the computer on which it will run. The program in a high-level language is called therun. The program in a high-level language is called the sourcesource program. The translated program in machineprogram. The translated program in machine language is called thelanguage is called the objectobject program. Two methodsprogram. Two methods are used for translation:are used for translation: compilation andand interpretation.. UniversityofEducationOkara Campus
  • 10. 10 Compilation A compiler normally translates the whole source program into the object program. Source Code > Object Code Interpretation Some computer languages use an interpreter to translate the source program into the object program. Interpretation refers to the process of translating each line of the source program into the corresponding line of the object program and executing the line. However, we need to be aware of two trends in interpretation: that is used by some languages before Java and the interpretation used by Java. UniversityofEducationOkara Campus
  • 11. 11 Translation process Compilation and interpretation differ in that the first translates the whole source code before executing it, while the second translates and executes the source code a line at a time. Both methods, however, follow the same translation process shown in Figure 9.1. Figure 1 Source code translation process UniversityofEducationOkara Campus
  • 12. 12 9-3 PROGRAMMING PARADIGMS9-3 PROGRAMMING PARADIGMS Today, computer languages are categorized according toToday, computer languages are categorized according to the approach they use to solve a problem. Athe approach they use to solve a problem. A paradigm, therefore, is a way in which a computer, therefore, is a way in which a computer language looks at the problem to be solved. We dividelanguage looks at the problem to be solved. We divide computer languages into four types:computer languages into four types: proceduralprocedural,, object-object- orientedoriented,, functionalfunctional andand declarativedeclarative. Figure 9.2. Figure 9.2 summarizes these.summarizes these. UniversityofEducationOkara Campus
  • 13. 13 Figure 2 Categories of programming languages UniversityofEducationOkara Campus
  • 14. 14 The Procedural Language A program in a procedural paradigm is an active agentA program in a procedural paradigm is an active agent that uses passive objects that we refer to as data or datathat uses passive objects that we refer to as data or data items. To manipulate a piece of data, the active agentitems. To manipulate a piece of data, the active agent (program) issues an action, referred to as a procedure.(program) issues an action, referred to as a procedure. For example, think of a program that prints the contentsFor example, think of a program that prints the contents of a file. The file is a passive object. To print the file, theof a file. The file is a passive object. To print the file, the program uses a procedure, which we call print.program uses a procedure, which we call print. Derived from Structured Programming.Derived from Structured Programming. UniversityofEducationOkara Campus Procedural Object-oriented procedure method record object module class procedure call message
  • 15. 15 Figure 3 The concept of the procedural paradigm UniversityofEducationOkara Campus
  • 16. 16 A program in this paradigm is made up of three parts: a part for object creation, a set of procedure calls and a set of code for each procedure. Some procedures have already been defined in the language itself. By combining this code, the programmer can create new procedures. Figure 4 The components of a procedural program UniversityofEducationOkara Campus
  • 17. 17 Some procedural languages  FORTRAN (FORmula TRANslation)  COBOL (COmmon Business-Oriented Language)  Pascal  C  Ada UniversityofEducationOkara Campus