SlideShare a Scribd company logo
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!

More Related Content

PPT
Introduction to java programming part 1
PPTX
Unit1 principle of programming language
PPTX
Object Oriented programming - Introduction
PDF
Java chapter 1
PPTX
PROCEDURAL ORIENTED PROGRAMMING VS OBJECT ORIENTED PROGRAMING
PDF
Java swing 1
PPT
Software development slides
DOC
Programming paradigms
Introduction to java programming part 1
Unit1 principle of programming language
Object Oriented programming - Introduction
Java chapter 1
PROCEDURAL ORIENTED PROGRAMMING VS OBJECT ORIENTED PROGRAMING
Java swing 1
Software development slides
Programming paradigms

What's hot (20)

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

Viewers also liked (19)

PPTX
Lect 2 assessing the technology landscape
PPTX
PPTX
PDF
Guia de estudio 2015 para docentes en servicio 1ra. carpeta
PPT
Software Processes
PPT
Android - An Introduction
PPT
Software Testing (Usability Testing of Website)
PPTX
Internet security software
PPTX
Itertaive process-development model
PPT
Introduction to java programming part 2
PPTX
Internet & Animal Sciences
PPT
System Development Proecess
PPT
PPTX
How Information System is Implmanted in an Organization
PPTX
Zoology Related Software
PPT
Report Management System
PPT
Lecture 1 Information System
Lect 2 assessing the technology landscape
Guia de estudio 2015 para docentes en servicio 1ra. carpeta
Software Processes
Android - An Introduction
Software Testing (Usability Testing of Website)
Internet security software
Itertaive process-development model
Introduction to java programming part 2
Internet & Animal Sciences
System Development Proecess
How Information System is Implmanted in an Organization
Zoology Related Software
Report Management System
Lecture 1 Information System
Ad

Similar to Introduction to programming languages part 2 (20)

PPT
Introduction to programing languages part 2
PPT
Introduction to programing languages part 3
PPTX
a brief explanation on the topic of Imperative Programming Paradigm.pptx
PPTX
Programming paradigms Techniques_part2.pptx
PDF
Programming languages and concepts by vivek parihar
PPT
Introduction to programing languages part 1
PPT
Oop concept
PPTX
OOPJ.pptx
PPTX
PROGRAMMING, the presentation is about,,
PPTX
Full Basic Programming in c material ppt
PPTX
Programming language paradigms
PDF
A Brief History of Programming Languages.pdf
PDF
Scope, binding, papameter passing techniques
PPTX
[OOP - Lec 02] Why do we need OOP
PPT
Programing Language
PPTX
PARADIGM IT.pptx
PPTX
Chapter_8_Designing_Efficient_Programs.pptx
PPT
Introduction to computers and programing.pptx
PPT
programing fundamentals by dr. wheedh khan
PPTX
Hema wt (1)
Introduction to programing languages part 2
Introduction to programing languages part 3
a brief explanation on the topic of Imperative Programming Paradigm.pptx
Programming paradigms Techniques_part2.pptx
Programming languages and concepts by vivek parihar
Introduction to programing languages part 1
Oop concept
OOPJ.pptx
PROGRAMMING, the presentation is about,,
Full Basic Programming in c material ppt
Programming language paradigms
A Brief History of Programming Languages.pdf
Scope, binding, papameter passing techniques
[OOP - Lec 02] Why do we need OOP
Programing Language
PARADIGM IT.pptx
Chapter_8_Designing_Efficient_Programs.pptx
Introduction to computers and programing.pptx
programing fundamentals by dr. wheedh khan
Hema wt (1)

More from university of education,Lahore (20)

PPT
Activites and Time Planning
PPT
Classical Encryption Techniques
PPT
Activites and Time Planning
PPTX
OSI Security Architecture
PPTX
Network Security Terminologies
PPT
Project Scheduling, Planning and Risk Management
PPTX
Software Testing and Debugging
PPTX
PPT
Enterprise Application Integration
PPTX
PPTX
Itertaive Process Development
PPTX
Computer Aided Software Engineering Nayab Awan
PPTX
system level requirements gathering and analysis
Activites and Time Planning
Classical Encryption Techniques
Activites and Time Planning
OSI Security Architecture
Network Security Terminologies
Project Scheduling, Planning and Risk Management
Software Testing and Debugging
Enterprise Application Integration
Itertaive Process Development
Computer Aided Software Engineering Nayab Awan
system level requirements gathering and analysis

Recently uploaded (20)

PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PPTX
Cell Structure & Organelles in detailed.
PDF
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PPTX
Pharma ospi slides which help in ospi learning
PPTX
master seminar digital applications in india
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PPTX
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
PPTX
Cell Types and Its function , kingdom of life
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PPTX
PPH.pptx obstetrics and gynecology in nursing
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PPTX
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
PDF
TR - Agricultural Crops Production NC III.pdf
PDF
Basic Mud Logging Guide for educational purpose
PDF
VCE English Exam - Section C Student Revision Booklet
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
Final Presentation General Medicine 03-08-2024.pptx
Cell Structure & Organelles in detailed.
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Pharma ospi slides which help in ospi learning
master seminar digital applications in india
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
human mycosis Human fungal infections are called human mycosis..pptx
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
Cell Types and Its function , kingdom of life
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PPH.pptx obstetrics and gynecology in nursing
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
102 student loan defaulters named and shamed – Is someone you know on the list?
2.FourierTransform-ShortQuestionswithAnswers.pdf
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
TR - Agricultural Crops Production NC III.pdf
Basic Mud Logging Guide for educational purpose
VCE English Exam - Section C Student Revision Booklet

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)