PROGRAMMING PARADIGM
BY,
Anirudh Chauhan
Introduction to programming paradigm
Introduction
 A way of conceptualizing what it means to perform
computation and how tasks to be carried out on the
computer should be structured and organized.
 A programming paradigm is a fundamental style of
computer programming, serving as a way of building the
structure and elements of computer programs
Introduction
 Some languages are designed to support one
particular paradigm
 Smalltalk supports object-oriented programming
 Haskell supports functional programming
 Other programming languages support multiple
paradigms
 Object Pascal, C++, C#, Visual Basic, Common Lisp,
Scheme, Perl, Python, Ruby, Oz and F#.
Introduction
Programming paradigms differ in:
The concepts and abstractions used to
represent the elements of a program
(such as objects, functions, variables,
constraints, etc.)
The steps that compose a computation
(assignation, evaluation, data flow, control
flow, etc.).
Programming Paradigms
Programming paradigms
 There are four main Programming Paradigms.
Imperative : Machine-model based
Functional : Equations; Expression
Evaluation
Logical : First-order Logic Deduction
Object-Oriented : Programming with Data
Types
Why study so many programming languages ?
 To Improve our ability to Develop Effective algorithms.
 To improve Use of Existing Programming Languages.
 To allow a better choice of Programming Language.
 To make it Easier to design a new language.
Procedural Programming
Procedural Programming
 Often thought as a synonym for imperative
programming.
 Specifying the steps the program must take
to reach the desired state.
 Based upon the concept of the procedure
call.
Procedural Programming
 Procedures, also known as routines, subroutines, methods,
or functions that contain a series of computational steps to
be carried out.
 Any given procedure might be called at any point during a
program's execution, including by other procedures or itself.
 The syntax of such languages generally has the form
statement 1;
statement 2;
--------------
statement n;
Procedural Programming
 Often a better choice than simple sequential or
unstructured programming in many situations
which involve moderate complexity or require
significant ease of maintainability.
 The ability to re-use the same code at different
places in the program without copying it.
Procedural Programming
 An easier way to keep track of program flow than a collection of
"GOTO" or "JUMP" statements .
 The ability to be strongly modular or structured.
 Example of procedural programming are C, Pascal, Basic, FORTRAN
etc.
Functional Programming
Functional Programming
 Functional programming is a programming paradigm that
treats computation as the evaluation of mathematical
functions and avoids state changes and mutable data.
 Programs written using the functional programming
paradigm are much more easily representable using
mathematical concepts, and thus it is much more easy to
mathematically reason about functional programs than it is
to reason about programs written in any other paradigm.
Functional Programming
 The syntax of such languages is :
functionn { …function2 { function1 (data)} …}
 LISP was the first operational functional programming
language.
 The Haskell programming language was released in the
late 1980s in an attempt to gather together many ideas in
functional programming research.
 Up to this day, functional programming has not been very
popular except for a restricted number of application areas,
such as artificial intelligence.
Functional Programming
 In practice, the difference between a mathematical function
and the notion of a "function" used in imperative
programming is that imperative functions can have side
effects, changing the value of already calculated variables.
 Conversely, in functional code, the output value of a
function depends only on the arguments that are input to
the function, so calling a function f twice with the same
value for an argument x will produce the same result f(x)
both times.
 Examples of Functional Programming are C, LISP, ML .
Imperative Vs Non Imperative
Imperative VS non imperative
 Functional/Logic programs specify WHAT is to be computed
abstractly, leaving the details of data organization and
instruction sequencing to the interpreter.
 In contrast, Imperative programs describe
the details of HOW the results are to be obtained, in terms of
the underlying machine model.
 Functional/Logic style clearly separates WHAT aspects of a
program (programmers’ responsibility) from the HOW aspects
(implementation decisions).
 An Imperative program contains both the specification and the
implementation details, inseparably inter-twined.
Imperative VS Non Imperative
Imperative
• Program: a
sequence of
instructions for a von
Neumann m/c.
• Computation by
instruction execution.
• Iteration.
• Modifiable or
updateable variables.
Non imperative
• Program: a collection
of function definitions
(m/c independent).
• Computation by term
rewriting.
• Recursion.
• Assign-only-once
variables.
Logical Programming
Logical Programming
 Also known as Rule based programming
and Declarative programming.
 Rule based programming checks for
presence for a certain condition and when
present execute an appropriate action.
Logical Programming
 We can describe rule-based languages as a set of filters to
apply to data storage. Enabling conditions determine order
of execution. The syntax of such Languages generally is
similar to the following.
enabling condition1→action1
enabling condition2→action2
..........................
enabling conditionn→actionn
 Some examples of logical programming languages are
Prolog, Ant, Oz, SQL etc.
Object Oriented Programming
Object Oriented Programming
 Object-oriented programming (OOP) is a programming
paradigm that uses "objects" – data structures
encapsulating data fields and procedures together with their
interactions – to design applications and computer
programs.
 Associated programming techniques may include features
such as data abstraction, encapsulation, modularity,
polymorphism, and inheritance.
Object oriented programming
 Though it was invented with the creation of the Simula
language in 1965, and further developed in Smalltalk in the
1970s, it was not commonly used in mainstream software
application development until the early 1990s.
 Many modern programming languages now support OOP.
 Examples of Object oriented Programming are C++, java,
Smalltalk, simula etc.
Thank You for your
consideration

Prgramming paradigms

  • 1.
  • 2.
  • 3.
    Introduction  A wayof conceptualizing what it means to perform computation and how tasks to be carried out on the computer should be structured and organized.  A programming paradigm is a fundamental style of computer programming, serving as a way of building the structure and elements of computer programs
  • 4.
    Introduction  Some languagesare designed to support one particular paradigm  Smalltalk supports object-oriented programming  Haskell supports functional programming  Other programming languages support multiple paradigms  Object Pascal, C++, C#, Visual Basic, Common Lisp, Scheme, Perl, Python, Ruby, Oz and F#.
  • 5.
    Introduction Programming paradigms differin: The concepts and abstractions used to represent the elements of a program (such as objects, functions, variables, constraints, etc.) The steps that compose a computation (assignation, evaluation, data flow, control flow, etc.).
  • 6.
  • 7.
    Programming paradigms  Thereare four main Programming Paradigms. Imperative : Machine-model based Functional : Equations; Expression Evaluation Logical : First-order Logic Deduction Object-Oriented : Programming with Data Types
  • 8.
    Why study somany programming languages ?  To Improve our ability to Develop Effective algorithms.  To improve Use of Existing Programming Languages.  To allow a better choice of Programming Language.  To make it Easier to design a new language.
  • 9.
  • 10.
    Procedural Programming  Oftenthought as a synonym for imperative programming.  Specifying the steps the program must take to reach the desired state.  Based upon the concept of the procedure call.
  • 11.
    Procedural Programming  Procedures,also known as routines, subroutines, methods, or functions that contain a series of computational steps to be carried out.  Any given procedure might be called at any point during a program's execution, including by other procedures or itself.  The syntax of such languages generally has the form statement 1; statement 2; -------------- statement n;
  • 12.
    Procedural Programming  Oftena better choice than simple sequential or unstructured programming in many situations which involve moderate complexity or require significant ease of maintainability.  The ability to re-use the same code at different places in the program without copying it.
  • 13.
    Procedural Programming  Aneasier way to keep track of program flow than a collection of "GOTO" or "JUMP" statements .  The ability to be strongly modular or structured.  Example of procedural programming are C, Pascal, Basic, FORTRAN etc.
  • 14.
  • 15.
    Functional Programming  Functionalprogramming is a programming paradigm that treats computation as the evaluation of mathematical functions and avoids state changes and mutable data.  Programs written using the functional programming paradigm are much more easily representable using mathematical concepts, and thus it is much more easy to mathematically reason about functional programs than it is to reason about programs written in any other paradigm.
  • 16.
    Functional Programming  Thesyntax of such languages is : functionn { …function2 { function1 (data)} …}  LISP was the first operational functional programming language.  The Haskell programming language was released in the late 1980s in an attempt to gather together many ideas in functional programming research.  Up to this day, functional programming has not been very popular except for a restricted number of application areas, such as artificial intelligence.
  • 17.
    Functional Programming  Inpractice, the difference between a mathematical function and the notion of a "function" used in imperative programming is that imperative functions can have side effects, changing the value of already calculated variables.  Conversely, in functional code, the output value of a function depends only on the arguments that are input to the function, so calling a function f twice with the same value for an argument x will produce the same result f(x) both times.  Examples of Functional Programming are C, LISP, ML .
  • 18.
  • 19.
    Imperative VS nonimperative  Functional/Logic programs specify WHAT is to be computed abstractly, leaving the details of data organization and instruction sequencing to the interpreter.  In contrast, Imperative programs describe the details of HOW the results are to be obtained, in terms of the underlying machine model.  Functional/Logic style clearly separates WHAT aspects of a program (programmers’ responsibility) from the HOW aspects (implementation decisions).  An Imperative program contains both the specification and the implementation details, inseparably inter-twined.
  • 20.
    Imperative VS NonImperative Imperative • Program: a sequence of instructions for a von Neumann m/c. • Computation by instruction execution. • Iteration. • Modifiable or updateable variables. Non imperative • Program: a collection of function definitions (m/c independent). • Computation by term rewriting. • Recursion. • Assign-only-once variables.
  • 21.
  • 22.
    Logical Programming  Alsoknown as Rule based programming and Declarative programming.  Rule based programming checks for presence for a certain condition and when present execute an appropriate action.
  • 23.
    Logical Programming  Wecan describe rule-based languages as a set of filters to apply to data storage. Enabling conditions determine order of execution. The syntax of such Languages generally is similar to the following. enabling condition1→action1 enabling condition2→action2 .......................... enabling conditionn→actionn  Some examples of logical programming languages are Prolog, Ant, Oz, SQL etc.
  • 24.
  • 25.
    Object Oriented Programming Object-oriented programming (OOP) is a programming paradigm that uses "objects" – data structures encapsulating data fields and procedures together with their interactions – to design applications and computer programs.  Associated programming techniques may include features such as data abstraction, encapsulation, modularity, polymorphism, and inheritance.
  • 26.
    Object oriented programming Though it was invented with the creation of the Simula language in 1965, and further developed in Smalltalk in the 1970s, it was not commonly used in mainstream software application development until the early 1990s.  Many modern programming languages now support OOP.  Examples of Object oriented Programming are C++, java, Smalltalk, simula etc.
  • 27.
    Thank You foryour consideration