SlideShare uma empresa Scribd logo
1 de 13
1
ProgrammingProgramming
Languages &Languages &
StructureStructure
University of Education Okara Campus
UniversityofEducationOkara
Campus
Part 2
2
1-3 The object-oriented paradigm
The object-oriented paradigm deals with active objects
instead of passive objects. We encounter many active
objects in our daily life: a vehicle, an automatic door, a
dishwasher and so on. The action to be performed on
these objects are included in the object: the objects need
only to receive the appropriate stimulus from outside to
perform one of the actions.
A file in an object-oriented paradigm can be
packed with all the procedures—called methods in the
object-oriented paradigm—to be performed by the file:
printing, copying, deleting and so on. The program in
this paradigm just sends the corresponding request to the
object.
UniversityofEducationOkara
Campus
3
Figure 5 The concept of an object-oriented paradigm
UniversityofEducationOkara
Campus
4
1-3 Classes
As Figure 9.5 shows, objects of the same type (files, for
example) need a set of methods that show how an object
of this type reacts to stimuli from outside the object’s
“territories”. To create these methods, a unit called a
class is used.
Figure 6 The concept of an object-oriented paradigm
UniversityofEducationOkara
Campus
5
1-3 Methods
In general, the format of methods are very similar to the
functions used in some procedural languages. Each
method has its header, its local variables and its
statement. This means that most of the features we
discussed for procedural languages are also applied to
methods written for an object-oriented program. In
other words, we can claim that object-oriented
languages are actually an extension of procedural
languages with some new ideas and some new features.
The C++ language, for example, is an object-oriented
extension of the C language.
Some object oriented languages = Java, C++
UniversityofEducationOkara
Campus
9.6
1-3 The functional paradigm
In the functional paradigm a program is considered a
mathematical function. In this context, a function is a
black box that maps a list of inputs to a list of outputs.
Figure 7 A function in a functional language
UniversityofEducationOkara
Campus
Some functional languages = LISP, Scheme
7
1-3 Prolog
One of the famous declarative languages is Prolog
(PROgramming in LOGic), developed by A.
Colmerauer in France in 1972. A program in Prolog is
made up of facts and rules. For example, the previous
facts about human beings can be stated as:
The user can then ask (query):
and the program will respond with yes.
UniversityofEducationOkara
Campus
8
1-4 COMMON CONCEPTS1-4 COMMON CONCEPTS
In this section we conduct a quick navigation throughIn this section we conduct a quick navigation through
some procedural languages to find common concepts.some procedural languages to find common concepts.
Some of these concepts are also available in mostSome of these concepts are also available in most
object-oriented languages because, as we explained, anobject-oriented languages because, as we explained, an
object-oriented paradigm uses the proceduralobject-oriented paradigm uses the procedural
paradigm when creating methods.paradigm when creating methods.
UniversityofEducationOkara
Campus
9
1-4 Identifiers
One feature present in all procedural languages, as well
as in other languages, is the identifier—that is, the
name of objects. Identifiers allow us to name objects in
the program. For example, each piece of data in a
computer is stored at a unique address. If there were no
identifiers to represent data locations symbolically, we
would have to know and use data addresses to
manipulate them. Instead, we simply give data names
and let the compiler keep track of where they are
physically located.
UniversityofEducationOkara
Campus
10
Data types and Variables
A data type defines a set of values and a set of operations that can be applied
to those values. The set of values for each type is known as the domain for the
type.
UniversityofEducationOkara
Campus
Variables are names for memory locations. As discussed in Chapter 5, each
memory location in a computer has an address. Although the addresses are
used by the computer internally, it is very inconvenient for the programmer to
use addresses. A programmer can use a variable, such as score, to store the
integer value of a score received in a test. Since a variable holds a data item, it
has a type.
e.g. int a
Here int is a data type and a is a variable
11
Literals
A literal is a predetermined value used in a program. For example,
if we need to calculate the area of circle when the value of the
radius is stored in the variable r, we can use the expression 3.14 ×
r2
, in which the approximate value of π (pi) is used as a literal. In
most programming languages we can have integer, real, character
and Boolean literals. In most languages, we can also have string
literals. To distinguish the character and string literals from the
names of variables and other objects, most languages require that
the character literals be enclosed in single quotes, such as 'A', and
strings to be enclosed in double quotes, such as "Anne".
UniversityofEducationOkara
Campus
The use of literals is not considered good programming practice
unless we are sure that the value of the literal will not change
with time (such as the value of π in geometry). However, most
literals may change value with time.
12
For this reason, most programming languages define constants. A
constant, like a variable, is a named location that can store a value, but the
value cannot be changed after it has been defined at the beginning of the
program. However, if we want to use the program later, we can change just
one line at the beginning of the program, the value of the constant.
e.g. int a = 10;
UniversityofEducationOkara
Campus
Inputs and Outputs
Almost every program needs to read and/or write data. These operations can
be quite complex, especially when we read and write large files. Most
programming languages use a predefined function for input and output in
JAVA.
system.println() for printing (output)
SCANNER for scanning (input)
9.13
UniversityofEducationOkara
Campus
Thanks!

Mais conteúdo relacionado

Mais procurados

Ppl for students unit 1,2 and 3
Ppl for students unit 1,2 and 3Ppl for students unit 1,2 and 3
Ppl for students unit 1,2 and 3Akshay Nagpurkar
 
Coding principles
Coding principles Coding principles
Coding principles DevAdnani
 
Java quick reference
Java quick referenceJava quick reference
Java quick referenceArthyR3
 
Principles of programming languages. Detail notes
Principles of programming languages. Detail notesPrinciples of programming languages. Detail notes
Principles of programming languages. Detail notesVIKAS SINGH BHADOURIA
 
Fundamentals of Language Processing
Fundamentals of Language ProcessingFundamentals of Language Processing
Fundamentals of Language ProcessingHemant Sharma
 
Imperative programming
Imperative programmingImperative programming
Imperative programmingEdward Blurock
 
ASPECT ORIENTED PROGRAMING(aop)
ASPECT ORIENTED PROGRAMING(aop)ASPECT ORIENTED PROGRAMING(aop)
ASPECT ORIENTED PROGRAMING(aop)kvsrteja
 
Aspect Oriented Programming Through C#.NET
Aspect Oriented Programming Through C#.NETAspect Oriented Programming Through C#.NET
Aspect Oriented Programming Through C#.NETWaqas Tariq
 
Chapter 1 - An Overview of Computers and Programming Languages
Chapter 1 - An Overview of Computers and Programming LanguagesChapter 1 - An Overview of Computers and Programming Languages
Chapter 1 - An Overview of Computers and Programming LanguagesAdan Hubahib
 
Java programming language
Java programming languageJava programming language
Java programming languageSubhashKumar329
 
Programming Paradigm & Languages
Programming Paradigm & LanguagesProgramming Paradigm & Languages
Programming Paradigm & LanguagesGaditek
 
Software development slides
Software development slidesSoftware development slides
Software development slidesiarthur
 
Phases of the Compiler - Systems Programming
Phases of the Compiler - Systems ProgrammingPhases of the Compiler - Systems Programming
Phases of the Compiler - Systems ProgrammingMukesh Tekwani
 
What is programming what are its benefits
What is programming  what are its benefits What is programming  what are its benefits
What is programming what are its benefits Vijay Singh Khatri
 
Overview of Language Processor : Fundamentals of LP , Symbol Table , Data Str...
Overview of Language Processor : Fundamentals of LP , Symbol Table , Data Str...Overview of Language Processor : Fundamentals of LP , Symbol Table , Data Str...
Overview of Language Processor : Fundamentals of LP , Symbol Table , Data Str...Bhavin Darji
 

Mais procurados (20)

Ppl for students unit 1,2 and 3
Ppl for students unit 1,2 and 3Ppl for students unit 1,2 and 3
Ppl for students unit 1,2 and 3
 
Coding principles
Coding principles Coding principles
Coding principles
 
Java quick reference
Java quick referenceJava quick reference
Java quick reference
 
Principles of programming languages. Detail notes
Principles of programming languages. Detail notesPrinciples of programming languages. Detail notes
Principles of programming languages. Detail notes
 
Fundamentals of Language Processing
Fundamentals of Language ProcessingFundamentals of Language Processing
Fundamentals of Language Processing
 
Imperative programming
Imperative programmingImperative programming
Imperative programming
 
Graphical programming
Graphical programmingGraphical programming
Graphical programming
 
ASPECT ORIENTED PROGRAMING(aop)
ASPECT ORIENTED PROGRAMING(aop)ASPECT ORIENTED PROGRAMING(aop)
ASPECT ORIENTED PROGRAMING(aop)
 
Aspect Oriented Programming Through C#.NET
Aspect Oriented Programming Through C#.NETAspect Oriented Programming Through C#.NET
Aspect Oriented Programming Through C#.NET
 
Chapter 1 - An Overview of Computers and Programming Languages
Chapter 1 - An Overview of Computers and Programming LanguagesChapter 1 - An Overview of Computers and Programming Languages
Chapter 1 - An Overview of Computers and Programming Languages
 
Java programming language
Java programming languageJava programming language
Java programming language
 
SD & D Implementation
SD & D ImplementationSD & D Implementation
SD & D Implementation
 
Programming Paradigm & Languages
Programming Paradigm & LanguagesProgramming Paradigm & Languages
Programming Paradigm & Languages
 
Compare between pop and oop
Compare between pop and oopCompare between pop and oop
Compare between pop and oop
 
Software development slides
Software development slidesSoftware development slides
Software development slides
 
Phases of the Compiler - Systems Programming
Phases of the Compiler - Systems ProgrammingPhases of the Compiler - Systems Programming
Phases of the Compiler - Systems Programming
 
What is programming what are its benefits
What is programming  what are its benefits What is programming  what are its benefits
What is programming what are its benefits
 
Overview of Language Processor : Fundamentals of LP , Symbol Table , Data Str...
Overview of Language Processor : Fundamentals of LP , Symbol Table , Data Str...Overview of Language Processor : Fundamentals of LP , Symbol Table , Data Str...
Overview of Language Processor : Fundamentals of LP , Symbol Table , Data Str...
 
C aptitude book
C aptitude bookC aptitude book
C aptitude book
 
Abhiram
AbhiramAbhiram
Abhiram
 

Destaque

Guia de estudio 2015 para docentes en servicio 1ra. carpeta
Guia de estudio 2015 para docentes en servicio  1ra. carpetaGuia de estudio 2015 para docentes en servicio  1ra. carpeta
Guia de estudio 2015 para docentes en servicio 1ra. carpetaCarlos M Brindis Valencia
 
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 Organizationuniversity of education,Lahore
 

Destaque (19)

Lect 2 assessing the technology landscape
Lect 2 assessing the technology landscapeLect 2 assessing the technology landscape
Lect 2 assessing the technology landscape
 
Microsoft Project
Microsoft ProjectMicrosoft Project
Microsoft Project
 
Lecture 6 DSS
Lecture 6  DSSLecture 6  DSS
Lecture 6 DSS
 
Software Testing
Software TestingSoftware Testing
Software Testing
 
Guia de estudio 2015 para docentes en servicio 1ra. carpeta
Guia de estudio 2015 para docentes en servicio  1ra. carpetaGuia de estudio 2015 para docentes en servicio  1ra. carpeta
Guia de estudio 2015 para docentes en servicio 1ra. carpeta
 
Software Processes
Software ProcessesSoftware Processes
Software Processes
 
Android - An Introduction
Android - An IntroductionAndroid - An Introduction
Android - An Introduction
 
Software Testing (Usability Testing of Website)
Software Testing (Usability Testing of Website)Software Testing (Usability Testing of Website)
Software Testing (Usability Testing of Website)
 
Internet security software
Internet security softwareInternet security software
Internet security software
 
Itertaive process-development model
Itertaive process-development modelItertaive process-development model
Itertaive process-development model
 
Introduction to java programming part 2
Introduction to java programming  part 2Introduction to java programming  part 2
Introduction to java programming part 2
 
Internet & Animal Sciences
Internet & Animal SciencesInternet & Animal Sciences
Internet & Animal Sciences
 
System Development Proecess
System Development ProecessSystem Development Proecess
System Development Proecess
 
levels of system
levels of systemlevels of system
levels of system
 
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
 
Zoology Related Software
Zoology Related SoftwareZoology Related Software
Zoology Related Software
 
M s access
M s accessM s access
M s access
 
Report Management System
Report Management SystemReport Management System
Report Management System
 
Lecture 1 Information System
Lecture 1  Information SystemLecture 1  Information System
Lecture 1 Information System
 

Semelhante a Introduction to programming languages part 2

Semelhante a Introduction to programming languages part 2 (20)

Introduction to programing languages part 3
Introduction to programing languages part 3Introduction to programing languages part 3
Introduction to programing languages part 3
 
Paradigms.pptx
Paradigms.pptxParadigms.pptx
Paradigms.pptx
 
Chapter1 introduction
Chapter1 introductionChapter1 introduction
Chapter1 introduction
 
Object Oriented Programming Lecture Notes
Object Oriented Programming Lecture NotesObject Oriented Programming Lecture Notes
Object Oriented Programming Lecture Notes
 
POP vs OOP Introduction
POP vs OOP IntroductionPOP vs OOP Introduction
POP vs OOP Introduction
 
Object oriented software engineering concepts
Object oriented software engineering conceptsObject oriented software engineering concepts
Object oriented software engineering concepts
 
Chapter1
Chapter1Chapter1
Chapter1
 
Introduction to programing languages part 1
Introduction to programing languages   part 1Introduction to programing languages   part 1
Introduction to programing languages part 1
 
1 intro
1 intro1 intro
1 intro
 
M.c.a (sem iii) paper - i - object oriented programming
M.c.a (sem   iii) paper - i - object oriented programmingM.c.a (sem   iii) paper - i - object oriented programming
M.c.a (sem iii) paper - i - object oriented programming
 
MCA NOTES.pdf
MCA NOTES.pdfMCA NOTES.pdf
MCA NOTES.pdf
 
Programming Languages An Intro
Programming Languages An IntroProgramming Languages An Intro
Programming Languages An Intro
 
Java chapter 3
Java   chapter 3Java   chapter 3
Java chapter 3
 
Object oriented programming in python
Object oriented programming in pythonObject oriented programming in python
Object oriented programming in python
 
Introduction to programing languages part 2
Introduction to programing languages   part 2Introduction to programing languages   part 2
Introduction to programing languages part 2
 
Oop in c++ lecture 1
Oop in c++  lecture 1Oop in c++  lecture 1
Oop in c++ lecture 1
 
OOPS_Unit_1
OOPS_Unit_1OOPS_Unit_1
OOPS_Unit_1
 
Basic concept of OOP's
Basic concept of OOP'sBasic concept of OOP's
Basic concept of OOP's
 
Java notes jkuat it
Java notes jkuat itJava notes jkuat it
Java notes jkuat it
 
Java notes(OOP) jkuat IT esection
Java notes(OOP) jkuat IT esectionJava notes(OOP) jkuat IT esection
Java notes(OOP) jkuat IT esection
 

Mais de university of education,Lahore

Mais de 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
 
system level requirements gathering and analysis
system level requirements gathering and analysissystem level requirements gathering and analysis
system level requirements gathering and analysis
 
Java Script
Java ScriptJava Script
Java Script
 

Último

The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docxPoojaSen20
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 
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 ConsultingTechSoup
 
Micromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersMicromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersChitralekhaTherkar
 
PSYCHIATRIC History collection FORMAT.pptx
PSYCHIATRIC   History collection FORMAT.pptxPSYCHIATRIC   History collection FORMAT.pptx
PSYCHIATRIC History collection FORMAT.pptxPoojaSen20
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 

Último (20)

The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docx
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 
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
 
Micromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersMicromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of Powders
 
PSYCHIATRIC History collection FORMAT.pptx
PSYCHIATRIC   History collection FORMAT.pptxPSYCHIATRIC   History collection FORMAT.pptx
PSYCHIATRIC History collection FORMAT.pptx
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 

Introduction to programming languages part 2

  • 1. 1 ProgrammingProgramming Languages &Languages & StructureStructure University of Education Okara Campus UniversityofEducationOkara Campus Part 2
  • 2. 2 1-3 The object-oriented paradigm The object-oriented paradigm deals with active objects instead of passive objects. We encounter many active objects in our daily life: a vehicle, an automatic door, a dishwasher and so on. The action to be performed on these objects are included in the object: the objects need only to receive the appropriate stimulus from outside to perform one of the actions. A file in an object-oriented paradigm can be packed with all the procedures—called methods in the object-oriented paradigm—to be performed by the file: printing, copying, deleting and so on. The program in this paradigm just sends the corresponding request to the object. UniversityofEducationOkara Campus
  • 3. 3 Figure 5 The concept of an object-oriented paradigm UniversityofEducationOkara Campus
  • 4. 4 1-3 Classes As Figure 9.5 shows, objects of the same type (files, for example) need a set of methods that show how an object of this type reacts to stimuli from outside the object’s “territories”. To create these methods, a unit called a class is used. Figure 6 The concept of an object-oriented paradigm UniversityofEducationOkara Campus
  • 5. 5 1-3 Methods In general, the format of methods are very similar to the functions used in some procedural languages. Each method has its header, its local variables and its statement. This means that most of the features we discussed for procedural languages are also applied to methods written for an object-oriented program. In other words, we can claim that object-oriented languages are actually an extension of procedural languages with some new ideas and some new features. The C++ language, for example, is an object-oriented extension of the C language. Some object oriented languages = Java, C++ UniversityofEducationOkara Campus
  • 6. 9.6 1-3 The functional paradigm In the functional paradigm a program is considered a mathematical function. In this context, a function is a black box that maps a list of inputs to a list of outputs. Figure 7 A function in a functional language UniversityofEducationOkara Campus Some functional languages = LISP, Scheme
  • 7. 7 1-3 Prolog One of the famous declarative languages is Prolog (PROgramming in LOGic), developed by A. Colmerauer in France in 1972. A program in Prolog is made up of facts and rules. For example, the previous facts about human beings can be stated as: The user can then ask (query): and the program will respond with yes. UniversityofEducationOkara Campus
  • 8. 8 1-4 COMMON CONCEPTS1-4 COMMON CONCEPTS In this section we conduct a quick navigation throughIn this section we conduct a quick navigation through some procedural languages to find common concepts.some procedural languages to find common concepts. Some of these concepts are also available in mostSome of these concepts are also available in most object-oriented languages because, as we explained, anobject-oriented languages because, as we explained, an object-oriented paradigm uses the proceduralobject-oriented paradigm uses the procedural paradigm when creating methods.paradigm when creating methods. UniversityofEducationOkara Campus
  • 9. 9 1-4 Identifiers One feature present in all procedural languages, as well as in other languages, is the identifier—that is, the name of objects. Identifiers allow us to name objects in the program. For example, each piece of data in a computer is stored at a unique address. If there were no identifiers to represent data locations symbolically, we would have to know and use data addresses to manipulate them. Instead, we simply give data names and let the compiler keep track of where they are physically located. UniversityofEducationOkara Campus
  • 10. 10 Data types and Variables A data type defines a set of values and a set of operations that can be applied to those values. The set of values for each type is known as the domain for the type. UniversityofEducationOkara Campus Variables are names for memory locations. As discussed in Chapter 5, each memory location in a computer has an address. Although the addresses are used by the computer internally, it is very inconvenient for the programmer to use addresses. A programmer can use a variable, such as score, to store the integer value of a score received in a test. Since a variable holds a data item, it has a type. e.g. int a Here int is a data type and a is a variable
  • 11. 11 Literals A literal is a predetermined value used in a program. For example, if we need to calculate the area of circle when the value of the radius is stored in the variable r, we can use the expression 3.14 × r2 , in which the approximate value of π (pi) is used as a literal. In most programming languages we can have integer, real, character and Boolean literals. In most languages, we can also have string literals. To distinguish the character and string literals from the names of variables and other objects, most languages require that the character literals be enclosed in single quotes, such as 'A', and strings to be enclosed in double quotes, such as "Anne". UniversityofEducationOkara Campus The use of literals is not considered good programming practice unless we are sure that the value of the literal will not change with time (such as the value of π in geometry). However, most literals may change value with time.
  • 12. 12 For this reason, most programming languages define constants. A constant, like a variable, is a named location that can store a value, but the value cannot be changed after it has been defined at the beginning of the program. However, if we want to use the program later, we can change just one line at the beginning of the program, the value of the constant. e.g. int a = 10; UniversityofEducationOkara Campus Inputs and Outputs Almost every program needs to read and/or write data. These operations can be quite complex, especially when we read and write large files. Most programming languages use a predefined function for input and output in JAVA. system.println() for printing (output) SCANNER for scanning (input)