SlideShare ist ein Scribd-Unternehmen logo
1 von 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. Because they used symbols, these languages were
first known as symbolic languages. The set of these mnemonic
languages were later referred to as assembly languages. The
assembly language for our hypothetical computer to replace the
machine language in Table 9.2 is shown in Program 9.1.
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
machine language of the computer on which it will run.machine language of the computer on which it will run.
The program in a high-level language is called theThe program in a high-level language is called the
source program. The translated program in machinesource program. The translated program in machine
language is called the object program. Two methodslanguage is called the object program. 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.
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 paradigms:computer languages into four paradigms: proceduralprocedural,,
object-orientedobject-oriented,, 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

Weitere ähnliche Inhalte

Was ist angesagt?

Lect 1. introduction to programming languages
Lect 1. introduction to programming languagesLect 1. introduction to programming languages
Lect 1. introduction to programming languages
Varun Garg
 
Basic programming concepts
Basic programming conceptsBasic programming concepts
Basic programming concepts
salmankhan570
 
Cmp2412 programming principles
Cmp2412 programming principlesCmp2412 programming principles
Cmp2412 programming principles
NIKANOR THOMAS
 
Programming Language
Programming  LanguageProgramming  Language
Programming Language
Adeel Hamid
 
Ndu06 typesof language
Ndu06 typesof languageNdu06 typesof language
Ndu06 typesof language
nicky_walters
 
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
 

Was ist angesagt? (20)

Object oriented concepts ppt
Object oriented concepts pptObject oriented concepts ppt
Object oriented concepts ppt
 
Programming Fundamentals lecture 2
Programming Fundamentals lecture 2Programming Fundamentals lecture 2
Programming Fundamentals lecture 2
 
SD & D Types of programming language
SD & D Types of programming languageSD & D Types of programming language
SD & D Types of programming language
 
Lect 1. introduction to programming languages
Lect 1. introduction to programming languagesLect 1. introduction to programming languages
Lect 1. introduction to programming languages
 
PROGRAMMING LANGUAGES
PROGRAMMING LANGUAGESPROGRAMMING LANGUAGES
PROGRAMMING LANGUAGES
 
Programming languages and concepts by vivek parihar
Programming languages and concepts by vivek pariharProgramming languages and concepts by vivek parihar
Programming languages and concepts by vivek parihar
 
Programming Fundamentals lecture 1
Programming Fundamentals lecture 1Programming Fundamentals lecture 1
Programming Fundamentals lecture 1
 
Programming Fundamental Presentation
Programming Fundamental PresentationProgramming Fundamental Presentation
Programming Fundamental Presentation
 
Basic programming concepts
Basic programming conceptsBasic programming concepts
Basic programming concepts
 
Introduction to compilers
Introduction to compilersIntroduction to compilers
Introduction to compilers
 
Programming landuages
Programming landuagesProgramming landuages
Programming landuages
 
Cmp2412 programming principles
Cmp2412 programming principlesCmp2412 programming principles
Cmp2412 programming principles
 
Programming Language
Programming  LanguageProgramming  Language
Programming Language
 
Introduction to c++ ppt 1
Introduction to c++ ppt 1Introduction to c++ ppt 1
Introduction to c++ ppt 1
 
Ndu06 typesof language
Ndu06 typesof languageNdu06 typesof language
Ndu06 typesof language
 
Problem solving methodology
Problem solving methodologyProblem solving methodology
Problem solving methodology
 
Introduction To Computer Programming
Introduction To Computer ProgrammingIntroduction To Computer Programming
Introduction To Computer Programming
 
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-
 
Introduction to c_language
Introduction to c_languageIntroduction to c_language
Introduction to c_language
 

Andere mochten auch

Programing language
Programing languagePrograming language
Programing language
James Taylor
 
Glosario de-términos-especificos-utilizados-en-la-red-5-oct-16
Glosario de-términos-especificos-utilizados-en-la-red-5-oct-16Glosario de-términos-especificos-utilizados-en-la-red-5-oct-16
Glosario de-términos-especificos-utilizados-en-la-red-5-oct-16
Steffany Sanchez
 
Futuristic programing language
Futuristic programing languageFuturistic programing language
Futuristic programing language
Mohamed Zaki
 
Describe professional programing languages and talks
Describe professional programing languages and talks Describe professional programing languages and talks
Describe professional programing languages and talks
Ed Bray
 
Intro To Programming Concepts
Intro To Programming ConceptsIntro To Programming Concepts
Intro To Programming Concepts
Jussi Pohjolainen
 
Programming fundamentals lecture 1&2
Programming fundamentals lecture 1&2Programming fundamentals lecture 1&2
Programming fundamentals lecture 1&2
Raja Hamid
 

Andere mochten auch (20)

Programing language
Programing languagePrograming language
Programing language
 
program development and paradigms
program development and paradigmsprogram development and paradigms
program development and paradigms
 
Introduction of Functional Programming
Introduction of Functional ProgrammingIntroduction of Functional Programming
Introduction of Functional Programming
 
Programming languages ms harsha
Programming languages ms harshaProgramming languages ms harsha
Programming languages ms harsha
 
Programing Language
Programing LanguagePrograming Language
Programing Language
 
programing laugauge
programing laugaugeprograming laugauge
programing laugauge
 
Glosario de-términos-especificos-utilizados-en-la-red-5-oct-16
Glosario de-términos-especificos-utilizados-en-la-red-5-oct-16Glosario de-términos-especificos-utilizados-en-la-red-5-oct-16
Glosario de-términos-especificos-utilizados-en-la-red-5-oct-16
 
Go programing language
Go programing languageGo programing language
Go programing language
 
Futuristic programing language
Futuristic programing languageFuturistic programing language
Futuristic programing language
 
Functional Programing
Functional ProgramingFunctional Programing
Functional Programing
 
Describe professional programing languages and talks
Describe professional programing languages and talks Describe professional programing languages and talks
Describe professional programing languages and talks
 
Intro To Programming Concepts
Intro To Programming ConceptsIntro To Programming Concepts
Intro To Programming Concepts
 
Intro to functional programming
Intro to functional programmingIntro to functional programming
Intro to functional programming
 
Programming fundamentals lecture 1&2
Programming fundamentals lecture 1&2Programming fundamentals lecture 1&2
Programming fundamentals lecture 1&2
 
Introduction of c programming
Introduction of c programmingIntroduction of c programming
Introduction of c programming
 
Generations Of Programming Languages
Generations Of Programming LanguagesGenerations Of Programming Languages
Generations Of Programming Languages
 
Programming Paradigm & Languages
Programming Paradigm & LanguagesProgramming Paradigm & Languages
Programming Paradigm & Languages
 
Introduction to computer programming
Introduction to computer programmingIntroduction to computer programming
Introduction to computer programming
 
Class 1
Class 1Class 1
Class 1
 
Prep velvet – Speed Maths
Prep velvet – Speed MathsPrep velvet – Speed Maths
Prep velvet – Speed Maths
 

Ähnlich wie Introduction to programing languages part 1

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
 
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
 
Procedural Programming Of Programming Languages
Procedural Programming Of Programming LanguagesProcedural Programming Of Programming Languages
Procedural Programming Of Programming Languages
Tammy Moncrief
 
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
 
The Concept Of Abstract Data Types
The Concept Of Abstract Data TypesThe Concept Of Abstract Data Types
The Concept Of Abstract Data Types
Katy Allen
 

Ähnlich wie Introduction to programing languages part 1 (20)

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
 
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
 
Procedural Programming Of Programming Languages
Procedural Programming Of Programming LanguagesProcedural Programming Of Programming Languages
Procedural Programming Of Programming Languages
 
Introduction to systems programming
Introduction to systems programmingIntroduction to systems programming
Introduction to systems programming
 
Chapter 1
Chapter 1Chapter 1
Chapter 1
 
Unit 1
Unit 1Unit 1
Unit 1
 
JAVA
JAVAJAVA
JAVA
 
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
 
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
 
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
 
The Concept Of Abstract Data Types
The Concept Of Abstract Data TypesThe Concept Of Abstract Data Types
The Concept Of Abstract Data Types
 
Programming
ProgrammingProgramming
Programming
 
Chapter 5
Chapter 5Chapter 5
Chapter 5
 
History Of C Essay
History Of C EssayHistory Of C Essay
History Of C Essay
 
Ppt about programming in methodology
Ppt about programming in methodology Ppt about programming in methodology
Ppt about programming in methodology
 
Programming
ProgrammingProgramming
Programming
 
CSCorganization of programming languages
CSCorganization of programming languagesCSCorganization of programming languages
CSCorganization of programming languages
 
SYSTEM DEVELOPMENT
SYSTEM DEVELOPMENTSYSTEM DEVELOPMENT
SYSTEM DEVELOPMENT
 

Mehr von university of education,Lahore

Mehr von 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
 

Kürzlich hochgeladen

Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
AnaAcapella
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
KarakKing
 

Kürzlich hochgeladen (20)

Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
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
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 

Introduction to programing 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. Because they used symbols, these languages were first known as symbolic languages. The set of these mnemonic languages were later referred to as assembly languages. The assembly language for our hypothetical computer to replace the machine language in Table 9.2 is shown in Program 9.1. 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 machine language of the computer on which it will run.machine language of the computer on which it will run. The program in a high-level language is called theThe program in a high-level language is called the source program. The translated program in machinesource program. The translated program in machine language is called the object program. Two methodslanguage is called the object program. 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. 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 paradigms:computer languages into four paradigms: proceduralprocedural,, object-orientedobject-oriented,, 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