Overview of Programming Paradigms Definitions z Programming Paradigm

  • Slides: 11
Download presentation
Overview of Programming Paradigms

Overview of Programming Paradigms

Definitions z. Programming Paradigm Õprogramming “technique” (? ) Õway of thinking about programming Õview

Definitions z. Programming Paradigm Õprogramming “technique” (? ) Õway of thinking about programming Õview of a program z. Programming Language Õconsists of words, symbols, and rules for writing a program

Programming Paradigms z. Imperative Programming Õprogram as a collection of statements and procedures affecting

Programming Paradigms z. Imperative Programming Õprogram as a collection of statements and procedures affecting data (variables) z. Object-Oriented Programming Õprogram as a collection of classes for interacting objects z. Functional Programming Õprogram as a collection of (math) functions

Some Languages by Paradigm z. Imperative (also called Structured or Procedural) Programming ÕFORTRAN, BASIC,

Some Languages by Paradigm z. Imperative (also called Structured or Procedural) Programming ÕFORTRAN, BASIC, COBOL, Pascal, C z. Object-Oriented Programming ÕSmall. Talk, C++, Java z. Functional Programming ÕLISP, ML, Haskell

History of Languages z 1950 s to 1960 s ÕFORTRAN, COBOL, LISP, BASIC z

History of Languages z 1950 s to 1960 s ÕFORTRAN, COBOL, LISP, BASIC z 1960 s to 1970 s Õ(ALGOL-based) Pascal and others z 1970 s to 1980 s ÕProlog, C, Ada z 1980 s to 1990 s ÕC++, ML, Perl, Java

Paradigm Change z. For example, from Structured to Object. Oriented z. Arises from problems

Paradigm Change z. For example, from Structured to Object. Oriented z. Arises from problems encountered in one paradigm but addressed in another z. Case study: from C to C++ ÕEvolution from structured, to modular, to object-based, to object-oriented programming

Object-Oriented Programming z. Incorporates both encapsulation and inheritance through the class concept z. Focus

Object-Oriented Programming z. Incorporates both encapsulation and inheritance through the class concept z. Focus is on writing good classes and on code reuse z. Examples ÕShape, Circle, and Rectangle in a drawing program ÕEmployee, Faculty, Staff in a university personnel system

Imperative Programming IT 240

Imperative Programming IT 240

Imperative Programming z. Variables, assignment, sequencing, iteration, procedures as units z. State-based, assignment-oriented z.

Imperative Programming z. Variables, assignment, sequencing, iteration, procedures as units z. State-based, assignment-oriented z. Global variables, side effects z. Program units: Data (Variables) and Computation (Statements and Routines)

Data and Computation z. Binding z. Data ÕVariables ÕData types z. Computation ÕAssignments and

Data and Computation z. Binding z. Data ÕVariables ÕData types z. Computation ÕAssignments and expressions ÕControl structures ÕSubprograms / routines

Modularity z. Interface and Implementation z. Compilation ÕIndependent ÕSeparate z. Libraries

Modularity z. Interface and Implementation z. Compilation ÕIndependent ÕSeparate z. Libraries