SlideShare a Scribd company logo
Unit-1- Introduction to Programming Paradigm
Programming Languages – Elements of Programming languages -
Programming Language Theory - Bohm- Jacopini structured program
theorem - Multiple Programming Paradigm – Programming Paradigm
hierarchy – Imperative Paradigm: Procedural, Object-Oriented and
Parallel processing – Declarative programming paradigm: Logic,
Functional and Database processing - Machine Codes – Procedural and
Object-Oriented Programming
Introduction to Programming Languages
What is a Programming Language?
•A programming language is a formal set of instructions that can be used to produce various kinds of
output. Programming languages are used to create software that controls the behavior of a machine,
particularly a computer.
•Purpose of Programming Languages
•Programming languages allow humans to communicate with machines in a way that is both
understandable to the machine and accessible to the human programmer. They bridge the gap between
human logic and machine instructions.
•Types of Programming Languages
•Low-Level Languages: These are closer to machine language (binary code) and include Assembly
Language. They provide more control over hardware but are more difficult to write and understand.
•High-Level Languages: These are closer to human languages and include languages like Python,
Java, and C++. They are easier to write, read, and maintain.
•Domain-Specific Languages: These are specialized for particular tasks, such as SQL for database
queries or HTML for web development.
Object-Oriented Languages: These languages emphasize the concept of objects,
which encapsulate both data and the functions (methods) that operate on that data.
Examples include Java, C++, C#, and Python.
Functional Languages: These languages treat computation as the evaluation of
mathematical functions and avoid changing state or mutable data. Examples
include Haskell, Lisp, and Erlang.
Domain-Specific Languages (DSLs): These languages are designed for specific
domains or problem areas, with specialized syntax and features tailored to those
domains. Examples include SQL for database management, HTML/CSS for web
development, and MATLAB for numerical computing.
Programming languages have different strengths and weaknesses, and
developers choose a language based on factors such as project requirements,
performance needs, development speed, community support, and personal
preference. Learning multiple languages can give programmers flexibility and allow
them to solve different types of problems more effectively.
Categories of Programming Languages
•Imperative Languages: These languages focus on how to execute tasks by specifying step-by-step
instructions (e.g., C, Java).
•Functional Languages: These emphasize the evaluation of functions and avoid changing state or
mutable data (e.g., Haskell, Lisp).
•Object-Oriented Languages: These languages use objects and classes to organize code in a way
that models real-world entities (e.g., Java, C++).
•Logic Languages: These are based on formal logic and allow programmers to declare what they
want rather than how to achieve it (e.g., Prolog).
•History and Evolution
•The first programming languages were developed in the early 1950s, with Assembly Language being
among the first. Over time, languages evolved to be more abstract and user-friendly, leading to the
modern languages we use today.
•Significance of Programming Languages
•Programming languages are crucial for the development of software, which runs almost every aspect
of modern life—from operating systems to applications, from websites to embedded systems in
devices.
Programming Language Theory
Formal Languages: Programming languages are often defined by formal
languages, which use formal grammar to describe the syntax and structure of
programs.
•Type Systems: A type system is a set of rules that assigns types to various
program constructs, such as variables, expressions, functions, and modules.
It ensures that operations are performed on compatible data types.
•Language Paradigms: These are different styles of programming, such as
imperative, functional, logic, and object-oriented paradigms. Each paradigm
offers different approaches to solving programming problems.
•Compiler Theory: This deals with how high-level programming languages
are translated into machine code that a computer can execute.
•Abstract Interpretation: A method used to analyze programs by simplifying
and approximating their behaviors, which helps in understanding program
properties and potential errors.
Elements of Programming Languages
•Syntax: Refers to the rules that define the structure of a programming language. It includes how symbols,
keywords, and punctuation are arranged to form valid programs. Syntax is like the grammar of a language.
•Semantics: Describes the meaning of syntactically valid programs. It defines what the program does when it
runs. For example, the semantics of an if statement is that it executes a block of code only if a certain condition is true.
•Pragmatics: Focuses on how programming language features are used in practice, considering aspects like
efficiency, readability, and ease of use.
•Types: Programming languages use types to classify data and determine what kind of operations can be
performed on that data. For example, integers, floats, and strings are different types in many languages.
•Variables and Scope: Variables are names given to data that can change over time. The scope of a variable
defines where it can be accessed in the program.
•Control Structures: These are constructs that dictate the flow of control in a program, such as loops (for, while),
conditionals (if, else), and branches (switch).
•Functions and Procedures: Functions (or procedures) are reusable blocks of code designed to perform a
specific task. They allow for code modularity and reduce repetition.
•Data Structures: These are ways to organize and store data in a program, such as arrays, lists, stacks, queues,
and trees.
Bohm-Jacopini Structured Program Theorem
Overview: The Bohm-Jacopini theorem, proposed by Corrado Böhm and Giuseppe Jacopini in
1966, is a fundamental result in programming language theory. It states that any computable
function can be implemented using just three control structures: sequence, selection (branching),
and iteration (loops).
Significance: This theorem laid the groundwork for structured programming, which advocates for
the use of these control structures to create clear, understandable, and maintainable programs. It
implies that "goto" statements, which were common in early programming, are unnecessary and
can lead to "spaghetti code."
Control Structures Defined:
•Sequence: The execution of statements in a linear order, one after another.
•Selection (Branching): Making decisions in a program using conditional statements like if-
else.
•Iteration (Looping): Repeating a block of code multiple times using loops like for, while,
and do-while.
•Structured Programming: The practice of structuring programs using these three control
structures to enhance readability and reduce complexity.
Advanced Programming practices - UNIT 1 .pptx
Advanced Programming practices - UNIT 1 .pptx
Advanced Programming practices - UNIT 1 .pptx
Advanced Programming practices - UNIT 1 .pptx
Advanced Programming practices - UNIT 1 .pptx
Advanced Programming practices - UNIT 1 .pptx
Advanced Programming practices - UNIT 1 .pptx
Advanced Programming practices - UNIT 1 .pptx
Advanced Programming practices - UNIT 1 .pptx
Advanced Programming practices - UNIT 1 .pptx
Advanced Programming practices - UNIT 1 .pptx
Machine Codes
• Definition:
• Machine code, or machine language, is the lowest-level programming language, consisting of
binary digits (0s and 1s) that the computer's central processing unit (CPU) can execute directly.
• Characteristics:
• Binary Format: Machine code is written in binary, which makes it difficult for humans to read
and write.
• Hardware-Specific: Machine code is specific to a computer's architecture, meaning that code
written for one type of CPU won't necessarily run on another.
• Fast Execution: Programs written in machine code are executed directly by the hardware,
making them extremely fast but difficult to debug and maintain.
• Use Cases:
• Machine code is primarily used in low-level programming, such as writing operating system
kernels, firmware, and device drivers.
Procedural Programming
•Definition:
•Procedural programming is a programming paradigm based on the concept of procedure calls, where
procedures, also known as functions, are a sequence of instructions that perform a specific task.
•Key Concepts:
•Functions/Procedures: Central to procedural programming, functions encapsulate reusable blocks of code.
•Sequence, Selection, Iteration: Control structures in procedural programming include sequences of
instructions, conditional statements (like if-else), and loops (like for, while).
•Global and Local Variables: Variables can be defined globally (accessible throughout the program) or locally
within a function.
•Advantages:
•Simplicity: Procedural programming is straightforward and easy to understand, especially for small programs.
•Reusability: Functions can be reused across different parts of a program, reducing redundancy.
•Limitations:
•Scalability: Procedural programming can become unwieldy in large projects, as it doesn’t naturally support
concepts like data encapsulation.
•Maintenance: Managing and modifying large procedural codebases can be challenging as they grow in
complexity.
•Examples:
•Languages like C, Pascal, and BASIC are well-known for procedural programming.
Object-Oriented Programming (OOP)
•Definition:
•Object-Oriented Programming is a paradigm that uses "objects"—which are instances of classes—
to design and structure software. It models real-world entities using objects that encapsulate both
data and behavior.
•Key Concepts:
•Classes and Objects: A class is a blueprint for creating objects. An object is an instance of a class
containing attributes (data) and methods (functions).
•Encapsulation: Bundling data and methods that operate on the data within a single unit, or class,
and restricting access to some of the object’s components.
•Inheritance: The ability to create a new class based on an existing class, inheriting attributes and
behaviors from the parent class.
•Polymorphism: The ability to process objects differently depending on their data type or class. For
example, the same method name can be used in different classes.
•Abstraction: The concept of hiding complex implementation details and showing only the essential
features of an object.
Advantages:
Modularity: OOP helps in organizing code into manageable sections or classes.
Code Reusability: Inheritance allows for code reuse across multiple classes.
Maintainability: The modularity of OOP makes it easier to update and maintain code.
Scalability: OOP naturally supports more complex and scalable systems compared to
procedural programming.
Limitations:
Complexity: OOP can be more complex to learn and implement, especially for
beginners.
Overhead: The abstraction layers in OOP may introduce overhead, which can affect
performance.
Examples:
Java, C++, Python, and Ruby are popular object-oriented languages.
Direct Procedure Call:
• What it is: In a direct procedure call, the method to be invoked is
determined at compile-time. This is typical in languages with static
binding.
• Overhead: The overhead is minimal because the address of the
method is known at compile-time, allowing for efficient calls. There's
no need to determine which method to execute at runtime.
Dynamically Dispatched Message Calls:
• What it is: In dynamically dispatched calls, the method to be invoked
is determined at runtime. This is typical in object-oriented languages
with dynamic binding (e.g., polymorphism in Java, C++).
• Overhead: The overhead is higher than in direct calls because the
runtime system must determine the appropriate method to invoke. This
typically involves looking up a method in a table (such as a vtable in
C++), which adds additional processing time.
Key Differences:
1.Method Resolution:
1. Direct Procedure Call: The method is resolved at compile-time.
2. Dynamically Dispatched Call: The method is resolved at runtime.
2.Efficiency:
1. Direct Procedure Call: More efficient due to compile-time resolution.
2. Dynamically Dispatched Call: Less efficient because of the additional
runtime lookup.
Direct Procedure Call:
class A {
void display() {
System.out.println("A's display");
}
}
public class Main {
public static void main(String[] args) {
A a = new A();
a.display(); // Direct call to A's display method.
}
}
class A {
void display() {
System.out.println("A's display");
}
}
class B extends A {
void display() {
System.out.println("B's display");
}
}
public class Main {
public static void main(String[] args) {
A a = new B(); a.display(); // Dynamically dispatched call to B's display method.
}
}
Dynamically Dispatched Message Calls

More Related Content

Similar to Advanced Programming practices - UNIT 1 .pptx (20)

PDF
Chapter-1-1 object oriented programing pdf.pdf
megbde32
 
PDF
Principles of programming languages .pdf
ssusera6e2c3
 
PPTX
Introduction-to-Programming-Languages.pptx
ranjan317165
 
PDF
Intro to programming and intro to java netbean.pdf
ErwinButchNicolas1
 
PPT
English de lenguaje de programacion
Villalba Griselda
 
PPTX
Ch1 language design issue
Jigisha Pandya
 
PPTX
Introduction To Computer Programming
Hussain Buksh
 
PPTX
APP_All Five Unit PPT_NOTES.pptx
HaniyaMumtaj1
 
PPT
Chapter 1- C++ programming languages +.ppt
anawaarabdujabbaar
 
PPTX
Define Computer language, Translator, Standard input out C
Dr Shailendra Bhalawe
 
PPTX
Introduction to Programming kkkkkkkkkkkkk
kimtrm34
 
ODP
Programming
vanesa4ab
 
PPTX
DMA113 Chap1
Bro Shola Ajayi
 
PPTX
Programming paradigms Techniques_part2.pptx
ssuser5ecd1a
 
PDF
Computer programing 111 lecture 1
ITNet
 
DOCX
Unit 1
ankita1317
 
DOCX
JAVA
sonali_iul
 
PPTX
01-PROGRAMMING introA of the class name. Pptx
simukondasankananji8
 
PDF
Programming language evolution and paradigm
hidrahrama
 
PDF
Introduction to computer programming language
hidrahrama
 
Chapter-1-1 object oriented programing pdf.pdf
megbde32
 
Principles of programming languages .pdf
ssusera6e2c3
 
Introduction-to-Programming-Languages.pptx
ranjan317165
 
Intro to programming and intro to java netbean.pdf
ErwinButchNicolas1
 
English de lenguaje de programacion
Villalba Griselda
 
Ch1 language design issue
Jigisha Pandya
 
Introduction To Computer Programming
Hussain Buksh
 
APP_All Five Unit PPT_NOTES.pptx
HaniyaMumtaj1
 
Chapter 1- C++ programming languages +.ppt
anawaarabdujabbaar
 
Define Computer language, Translator, Standard input out C
Dr Shailendra Bhalawe
 
Introduction to Programming kkkkkkkkkkkkk
kimtrm34
 
Programming
vanesa4ab
 
DMA113 Chap1
Bro Shola Ajayi
 
Programming paradigms Techniques_part2.pptx
ssuser5ecd1a
 
Computer programing 111 lecture 1
ITNet
 
Unit 1
ankita1317
 
01-PROGRAMMING introA of the class name. Pptx
simukondasankananji8
 
Programming language evolution and paradigm
hidrahrama
 
Introduction to computer programming language
hidrahrama
 

Recently uploaded (20)

PPTX
Day2 B2 Best.pptx
helenjenefa1
 
PDF
Basic_Concepts_in_Clinical_Biochemistry_2018كيمياء_عملي.pdf
AdelLoin
 
PPTX
265587293-NFPA 101 Life safety code-PPT-1.pptx
chandermwason
 
PPTX
Introduction to Neural Networks and Perceptron Learning Algorithm.pptx
Kayalvizhi A
 
PDF
Design Thinking basics for Engineers.pdf
CMR University
 
PPTX
Solar Thermal Energy System Seminar.pptx
Gpc Purapuza
 
PPTX
原版一样(Acadia毕业证书)加拿大阿卡迪亚大学毕业证办理方法
Taqyea
 
PDF
PORTFOLIO Golam Kibria Khan — architect with a passion for thoughtful design...
MasumKhan59
 
PPTX
Break Statement in Programming with 6 Real Examples
manojpoojary2004
 
PDF
monopile foundation seminar topic for civil engineering students
Ahina5
 
PDF
Unified_Cloud_Comm_Presentation anil singh ppt
anilsingh298751
 
PPTX
MPMC_Module-2 xxxxxxxxxxxxxxxxxxxxx.pptx
ShivanshVaidya5
 
DOC
MRRS Strength and Durability of Concrete
CivilMythili
 
PPTX
artificial intelligence applications in Geomatics
NawrasShatnawi1
 
PPTX
GitOps_Without_K8s_Training_detailed git repository
DanialHabibi2
 
PDF
MAD Unit - 2 Activity and Fragment Management in Android (Diploma IT)
JappanMavani
 
PPTX
Product Development & DevelopmentLecture02.pptx
zeeshanwazir2
 
PDF
Pressure Measurement training for engineers and Technicians
AIESOLUTIONS
 
PDF
Ethics and Trustworthy AI in Healthcare – Governing Sensitive Data, Profiling...
AlqualsaDIResearchGr
 
PDF
Biomechanics of Gait: Engineering Solutions for Rehabilitation (www.kiu.ac.ug)
publication11
 
Day2 B2 Best.pptx
helenjenefa1
 
Basic_Concepts_in_Clinical_Biochemistry_2018كيمياء_عملي.pdf
AdelLoin
 
265587293-NFPA 101 Life safety code-PPT-1.pptx
chandermwason
 
Introduction to Neural Networks and Perceptron Learning Algorithm.pptx
Kayalvizhi A
 
Design Thinking basics for Engineers.pdf
CMR University
 
Solar Thermal Energy System Seminar.pptx
Gpc Purapuza
 
原版一样(Acadia毕业证书)加拿大阿卡迪亚大学毕业证办理方法
Taqyea
 
PORTFOLIO Golam Kibria Khan — architect with a passion for thoughtful design...
MasumKhan59
 
Break Statement in Programming with 6 Real Examples
manojpoojary2004
 
monopile foundation seminar topic for civil engineering students
Ahina5
 
Unified_Cloud_Comm_Presentation anil singh ppt
anilsingh298751
 
MPMC_Module-2 xxxxxxxxxxxxxxxxxxxxx.pptx
ShivanshVaidya5
 
MRRS Strength and Durability of Concrete
CivilMythili
 
artificial intelligence applications in Geomatics
NawrasShatnawi1
 
GitOps_Without_K8s_Training_detailed git repository
DanialHabibi2
 
MAD Unit - 2 Activity and Fragment Management in Android (Diploma IT)
JappanMavani
 
Product Development & DevelopmentLecture02.pptx
zeeshanwazir2
 
Pressure Measurement training for engineers and Technicians
AIESOLUTIONS
 
Ethics and Trustworthy AI in Healthcare – Governing Sensitive Data, Profiling...
AlqualsaDIResearchGr
 
Biomechanics of Gait: Engineering Solutions for Rehabilitation (www.kiu.ac.ug)
publication11
 
Ad

Advanced Programming practices - UNIT 1 .pptx

  • 1. Unit-1- Introduction to Programming Paradigm Programming Languages – Elements of Programming languages - Programming Language Theory - Bohm- Jacopini structured program theorem - Multiple Programming Paradigm – Programming Paradigm hierarchy – Imperative Paradigm: Procedural, Object-Oriented and Parallel processing – Declarative programming paradigm: Logic, Functional and Database processing - Machine Codes – Procedural and Object-Oriented Programming
  • 2. Introduction to Programming Languages What is a Programming Language? •A programming language is a formal set of instructions that can be used to produce various kinds of output. Programming languages are used to create software that controls the behavior of a machine, particularly a computer. •Purpose of Programming Languages •Programming languages allow humans to communicate with machines in a way that is both understandable to the machine and accessible to the human programmer. They bridge the gap between human logic and machine instructions. •Types of Programming Languages •Low-Level Languages: These are closer to machine language (binary code) and include Assembly Language. They provide more control over hardware but are more difficult to write and understand. •High-Level Languages: These are closer to human languages and include languages like Python, Java, and C++. They are easier to write, read, and maintain. •Domain-Specific Languages: These are specialized for particular tasks, such as SQL for database queries or HTML for web development.
  • 3. Object-Oriented Languages: These languages emphasize the concept of objects, which encapsulate both data and the functions (methods) that operate on that data. Examples include Java, C++, C#, and Python. Functional Languages: These languages treat computation as the evaluation of mathematical functions and avoid changing state or mutable data. Examples include Haskell, Lisp, and Erlang. Domain-Specific Languages (DSLs): These languages are designed for specific domains or problem areas, with specialized syntax and features tailored to those domains. Examples include SQL for database management, HTML/CSS for web development, and MATLAB for numerical computing. Programming languages have different strengths and weaknesses, and developers choose a language based on factors such as project requirements, performance needs, development speed, community support, and personal preference. Learning multiple languages can give programmers flexibility and allow them to solve different types of problems more effectively.
  • 4. Categories of Programming Languages •Imperative Languages: These languages focus on how to execute tasks by specifying step-by-step instructions (e.g., C, Java). •Functional Languages: These emphasize the evaluation of functions and avoid changing state or mutable data (e.g., Haskell, Lisp). •Object-Oriented Languages: These languages use objects and classes to organize code in a way that models real-world entities (e.g., Java, C++). •Logic Languages: These are based on formal logic and allow programmers to declare what they want rather than how to achieve it (e.g., Prolog). •History and Evolution •The first programming languages were developed in the early 1950s, with Assembly Language being among the first. Over time, languages evolved to be more abstract and user-friendly, leading to the modern languages we use today. •Significance of Programming Languages •Programming languages are crucial for the development of software, which runs almost every aspect of modern life—from operating systems to applications, from websites to embedded systems in devices.
  • 5. Programming Language Theory Formal Languages: Programming languages are often defined by formal languages, which use formal grammar to describe the syntax and structure of programs. •Type Systems: A type system is a set of rules that assigns types to various program constructs, such as variables, expressions, functions, and modules. It ensures that operations are performed on compatible data types. •Language Paradigms: These are different styles of programming, such as imperative, functional, logic, and object-oriented paradigms. Each paradigm offers different approaches to solving programming problems. •Compiler Theory: This deals with how high-level programming languages are translated into machine code that a computer can execute. •Abstract Interpretation: A method used to analyze programs by simplifying and approximating their behaviors, which helps in understanding program properties and potential errors.
  • 6. Elements of Programming Languages •Syntax: Refers to the rules that define the structure of a programming language. It includes how symbols, keywords, and punctuation are arranged to form valid programs. Syntax is like the grammar of a language. •Semantics: Describes the meaning of syntactically valid programs. It defines what the program does when it runs. For example, the semantics of an if statement is that it executes a block of code only if a certain condition is true. •Pragmatics: Focuses on how programming language features are used in practice, considering aspects like efficiency, readability, and ease of use. •Types: Programming languages use types to classify data and determine what kind of operations can be performed on that data. For example, integers, floats, and strings are different types in many languages. •Variables and Scope: Variables are names given to data that can change over time. The scope of a variable defines where it can be accessed in the program. •Control Structures: These are constructs that dictate the flow of control in a program, such as loops (for, while), conditionals (if, else), and branches (switch). •Functions and Procedures: Functions (or procedures) are reusable blocks of code designed to perform a specific task. They allow for code modularity and reduce repetition. •Data Structures: These are ways to organize and store data in a program, such as arrays, lists, stacks, queues, and trees.
  • 7. Bohm-Jacopini Structured Program Theorem Overview: The Bohm-Jacopini theorem, proposed by Corrado Böhm and Giuseppe Jacopini in 1966, is a fundamental result in programming language theory. It states that any computable function can be implemented using just three control structures: sequence, selection (branching), and iteration (loops). Significance: This theorem laid the groundwork for structured programming, which advocates for the use of these control structures to create clear, understandable, and maintainable programs. It implies that "goto" statements, which were common in early programming, are unnecessary and can lead to "spaghetti code." Control Structures Defined: •Sequence: The execution of statements in a linear order, one after another. •Selection (Branching): Making decisions in a program using conditional statements like if- else. •Iteration (Looping): Repeating a block of code multiple times using loops like for, while, and do-while. •Structured Programming: The practice of structuring programs using these three control structures to enhance readability and reduce complexity.
  • 19. Machine Codes • Definition: • Machine code, or machine language, is the lowest-level programming language, consisting of binary digits (0s and 1s) that the computer's central processing unit (CPU) can execute directly. • Characteristics: • Binary Format: Machine code is written in binary, which makes it difficult for humans to read and write. • Hardware-Specific: Machine code is specific to a computer's architecture, meaning that code written for one type of CPU won't necessarily run on another. • Fast Execution: Programs written in machine code are executed directly by the hardware, making them extremely fast but difficult to debug and maintain. • Use Cases: • Machine code is primarily used in low-level programming, such as writing operating system kernels, firmware, and device drivers.
  • 20. Procedural Programming •Definition: •Procedural programming is a programming paradigm based on the concept of procedure calls, where procedures, also known as functions, are a sequence of instructions that perform a specific task. •Key Concepts: •Functions/Procedures: Central to procedural programming, functions encapsulate reusable blocks of code. •Sequence, Selection, Iteration: Control structures in procedural programming include sequences of instructions, conditional statements (like if-else), and loops (like for, while). •Global and Local Variables: Variables can be defined globally (accessible throughout the program) or locally within a function. •Advantages: •Simplicity: Procedural programming is straightforward and easy to understand, especially for small programs. •Reusability: Functions can be reused across different parts of a program, reducing redundancy. •Limitations: •Scalability: Procedural programming can become unwieldy in large projects, as it doesn’t naturally support concepts like data encapsulation. •Maintenance: Managing and modifying large procedural codebases can be challenging as they grow in complexity. •Examples: •Languages like C, Pascal, and BASIC are well-known for procedural programming.
  • 21. Object-Oriented Programming (OOP) •Definition: •Object-Oriented Programming is a paradigm that uses "objects"—which are instances of classes— to design and structure software. It models real-world entities using objects that encapsulate both data and behavior. •Key Concepts: •Classes and Objects: A class is a blueprint for creating objects. An object is an instance of a class containing attributes (data) and methods (functions). •Encapsulation: Bundling data and methods that operate on the data within a single unit, or class, and restricting access to some of the object’s components. •Inheritance: The ability to create a new class based on an existing class, inheriting attributes and behaviors from the parent class. •Polymorphism: The ability to process objects differently depending on their data type or class. For example, the same method name can be used in different classes. •Abstraction: The concept of hiding complex implementation details and showing only the essential features of an object.
  • 22. Advantages: Modularity: OOP helps in organizing code into manageable sections or classes. Code Reusability: Inheritance allows for code reuse across multiple classes. Maintainability: The modularity of OOP makes it easier to update and maintain code. Scalability: OOP naturally supports more complex and scalable systems compared to procedural programming. Limitations: Complexity: OOP can be more complex to learn and implement, especially for beginners. Overhead: The abstraction layers in OOP may introduce overhead, which can affect performance. Examples: Java, C++, Python, and Ruby are popular object-oriented languages.
  • 23. Direct Procedure Call: • What it is: In a direct procedure call, the method to be invoked is determined at compile-time. This is typical in languages with static binding. • Overhead: The overhead is minimal because the address of the method is known at compile-time, allowing for efficient calls. There's no need to determine which method to execute at runtime.
  • 24. Dynamically Dispatched Message Calls: • What it is: In dynamically dispatched calls, the method to be invoked is determined at runtime. This is typical in object-oriented languages with dynamic binding (e.g., polymorphism in Java, C++). • Overhead: The overhead is higher than in direct calls because the runtime system must determine the appropriate method to invoke. This typically involves looking up a method in a table (such as a vtable in C++), which adds additional processing time.
  • 25. Key Differences: 1.Method Resolution: 1. Direct Procedure Call: The method is resolved at compile-time. 2. Dynamically Dispatched Call: The method is resolved at runtime. 2.Efficiency: 1. Direct Procedure Call: More efficient due to compile-time resolution. 2. Dynamically Dispatched Call: Less efficient because of the additional runtime lookup.
  • 26. Direct Procedure Call: class A { void display() { System.out.println("A's display"); } } public class Main { public static void main(String[] args) { A a = new A(); a.display(); // Direct call to A's display method. } }
  • 27. class A { void display() { System.out.println("A's display"); } } class B extends A { void display() { System.out.println("B's display"); } } public class Main { public static void main(String[] args) { A a = new B(); a.display(); // Dynamically dispatched call to B's display method. } } Dynamically Dispatched Message Calls